php - Laravel 4 : How to combine where and with in eloquent ORM -
i want json logged in user checklist(s). how combine ::where , ::with?
this gives me logged in user:
$user = user::where('user_id', '=', auth::user()->user_id)->get();
this gives me users , checklist(s):
$user = user::with('checklists')->get();
user::with()
return eloquent query object,
$user = user::with('checklists') ->where('user_id', '=', auth::user()->user_id) ->get();
Comments
Post a Comment