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



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire