I have 2 tables with foreign key relationship. Situation is I have a case
and a case
have many revision
s and every revision
h
Use a join here:
$the_data_you_want = Case::join('case_revisions', 'case.id', '=', 'case_revisions.case_id')
->where('status', 'treatment')
->get();
PrimaryCaseNo
and impression_type
were not mentioned in the explanation of the question so I ignored them, you can change this if necessary.
I hope this helps you.