How to get data from parent and child table on the basis of status where foreign key have different status for every row

前端 未结 1 408
无人及你
无人及你 2021-01-28 19:36

I have 2 tables with foreign key relationship. Situation is I have a case and a case have many revisions and every revision h

相关标签:
1条回答
  • 2021-01-28 20:21

    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.

    0 讨论(0)
提交回复
热议问题