Laravel 5 Laravel with()不在clousure所在的范围内工作
假设我有routineDetails,它有一个分配,该分配有一个会议。 当我尝试使用此选项时:Laravel 5 Laravel with()不在clousure所在的范围内工作,laravel-5,eloquent,Laravel 5,Eloquent,假设我有routineDetails,它有一个分配,该分配有一个会议。 当我尝试使用此选项时: $date='2020-11-12'; $route_details = $this->routineDetail ->whereHas('allocation', function ($q) use ($all_sub_ids, $date) { $q->whereIn('subject_id', $
$date='2020-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();
此查询不起作用。当我打印时
foreach ($route_details as $k => $detail) {
dd($detail->allocation->liveMeeting);
}
它返回第一次会议和另一个日期。我猜where查询($q->where('join_date',$date);)没有命中!
我希望所有的例行程序,有选定的科目分配,并与分配会议。
有什么办法吗?提前谢谢