【发布时间】:2019-12-04 10:22:12
【问题描述】:
我有 2 张桌子 employees 和 employee_locations。一名员工有许多地点。我需要找出一条具有相关最新employee_locations 记录的员工记录。我写了下面的查询。
$employees = Employee::find([1])->with('employees.employee_locations')->latest()->first();
我遇到了错误
BadMethodCallException
Method Illuminate\Database\Eloquent\Collection::with does not exist.
【问题讨论】:
标签: sql eloquent laravel-6.2