query relationships laravel and select some columns subquery code example
Example: query relationships laravel and select some columns
Post::query()
->with(array('user' => function($query) {
$query->select('id','username');
}))
->get();