Laravel with() not working within whereHas clousure

Suppose i have routineDetails that has one allocation and that allocation has one meeting. When i try to use this:

$date='2022-11-12';
$route_details = $this->routineDetail
->whereHas('allocation', function ($q) use ($all_sub_ids, $date) {
$q->whereIn('subject_id', $all_sub_ids)
->with(['liveMeeting' => function ($q) use ($date) {
$q->where('join_date', $date);
}]);
})->get();

This query not working well. When i print

     foreach ($route_details as $k => $detail) {


dd($detail->allocation->liveMeeting);
}

It returns first meeting with date another. I guess the where query ($q->where('join_date', $date); ) not hit! I want all routines that has allocation of selected subjects and that has meeting with the allocation. Is there any way to do so ? Thanks in advance.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3eWBNH0
via IFTTT

تعليقات

المشاركات الشائعة من هذه المدونة

I am unable to figure out how to create payment collection request, after a form has been submitted in laravel

laravel, mysql transaction not working after failed one time