vendredi 27 août 2021

multiple with with closure in laravel

I'm trying to filter data first closure is for attachment and second closure for AdminAttachment

   $data = UserSalary::with(['userData','Attachments' => function($query) use($id) {
        $query->where('type', 3);
        $query->where('application_id',$id);
      }])->with(['AdminAttachments' => function($queryadminattachement) use($id) {
        $queryadminattachement->where('type', 3);
        $queryadminattachement->where('application_id',$id);
      }])->find($id);

but now i'm getting only Attachment data but AdminAttachment is blank but in my database data is there so it must return datas from both the attachment because search criteria is also same. Any solution please

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire