laravel eloquent relationships select code example
Example 1: eloquent relationships
$roles = App\User::find(1)->roles()->orderBy('name')->get();
Example 2: query relationships laravel and select some columns
Post::query()
->with(array('user' => function($query) {
$query->select('id','username');
}))
->get();