lundi 20 février 2017

Laravel with(): What this method does?

I am new on Laravel and working on small application. In Laravel tutorials, I have read the with() method of Eloquent model but not able to understand it's working clearly.

I have seen many tutorials to clear this concept. Somebody post small understanding and somebody post deep understanding of with() method. At one place someone trying to clear this below example:

$collection = Model_1::where("year", 2016)->with(array("Model_2"=>function($q){$q->with("Model_3","Model_4");}))->with("Model_5","Model_6")->get()->toArray();  

Overall, still I am not able to understand the concept of this method. Please anyone can clear me the concept of with() method and explain the working of above statement? Thanks in Advance.



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

Aucun commentaire:

Enregistrer un commentaire