我猜我有语法问题 . 我正在尝试将嵌套在另一个中的集合分组 . 这些集合一直在使用'with'进行检索,因为它们之间存在关系 . 我的grouBy代码抛出一个错误,表示我正在传递一个对象 .
strtolower()期望参数1为字符串,给定对象
这是什么问题?
$clientAndAppointments = Client::where('status', 1)->orderby('first_name', 'asc')
->with(['appointments' => function ($query) use ($weekStart, $weekEnd) {
$query->whereBetween('starts_at', [$weekStart, $weekEnd])->groupBy(function($day) {
return Carbon::parse($day->starts_at, 'Europe/London')->format('l');
});
}, 'appointments.employees.user'])->with('careType')->get();