Load relationships in query

This commit is contained in:
snipe 2017-05-23 02:46:03 -07:00
parent eb3aa99e4f
commit bb323db685

View file

@ -26,8 +26,9 @@ class DepartmentsController extends Controller
$departments = Department::select([
'id',
'name',
'location_id'
])->with('users')->withCount('users');
'location_id',
'manager_id'
])->with('users')->with('location')->with('manager')->withCount('users');
if ($request->has('search')) {
$departments = $departments->TextSearch($request->input('search'));