【发布时间】:2023-01-16 18:42:29
【问题描述】:
我想在 laravel 雄辩的子查询中使用记录字段
我试过这个
$clients = Client::with(['records' => function (Builder $query) {
// how can i take a record fields there?
$record = $query->first();
$query->where('time', Carbon::now()->subMinutes(10 + $record->duration);
}])->where('profile_id', $profile->id)->get();
如何才能做到这一点?
【问题讨论】:
标签: php laravel eloquent relationship