Friday, March 17, 2017

Pluck Eager Loading Laravel 5.4

How would I pluck an eager loading content while querying with Laravel 5.4?

I tried this way:

$something = Something::with(array('something_else' => function($query){
    $query->pluck('field');
}))->first();

And $query->select('field') too, but without luck. Is this possible in Laravel 5.4?



via Luiz

Advertisement