vendredi 30 octobre 2015

Laravel 5.1 - return eloquent model with multiple relationships

I have the following models Show, Presenter, Image.

Shows can have multiple presenters. Presenters have one image.

I can do this to get a presenter with their image:

$presenter = Presenter::with('image)->find(1);

And I can do this to get a show with presenters:

$show = Show::with('presenters')->find(1);

Is there a way I can return a show with presenters and their image in one statement?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire