vendredi 28 septembre 2018

Select fields in Laravel Eloquent with relation

How can I select fields in a laravel eloquent object what I mean

User::select('username', 'firstname', 'lastname')->with(['periods' => function($){
   $->select('jobtitle')->orderBy('start_date', 'desc')->limit(1);
}])->get();

in may case on this query I get periods null



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2OXRBeM
via IFTTT

Aucun commentaire:

Enregistrer un commentaire