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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -