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