vendredi 4 mars 2016

Laravel 5 Model chaining

Assume A,B,C,D are models. Is there a way to cleanly chain models like so: a->b()->c()->d()->get();? When trying to do this I get an error since a->b(), b->c(), and c->d() all return sets and a single object.

Some people have suggested eager loading in other sites but I have no idea how to use them. So far I have gone like a->load('b.c.d'); and in hopes of loading all the models to a but it didnt work.

How can I load all relevant models b,c,and d to a?



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

Aucun commentaire:

Enregistrer un commentaire