samedi 21 mai 2016

Laravel eager load with select

I have two tables with relations. The query below is working but I want to implement a select to display only specific columns from the 'images' relation. With select, the result is null.

$data['listings'] = Listings::with(['images' => function($query) {
           $query->select('filename', 'location') 
                 ->where('is_default', '=', 1);
    }])
    ->get();



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1TtqkOg
via IFTTT

Aucun commentaire:

Enregistrer un commentaire