I have the following in my index controller:
$recipes = Recipe::with(['color', 'glass', 'garnishes', 'recipeLines.fraction','recipeLines.unitOfMeasure','recipeLines.brand','recipeLines.product','recipeLines.ingredient', 'method', 'howServed', 'equipment', 'uom', 'products'])->where('location', $this->getLocation())
->whereBetween('updat', array($this->getListFromDate(), $this->getListToDate()))
->paginate($this->getItemsPerPage());
I thought that by using with()
that Laravel would change my model relationships from individual selects to joins when Recipe::all()
is called but when I look at DB::connection('remoteRecipes')->getQueryLog()
I see 50 select queries instead of one.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1PBvyCj
via IFTTT
Aucun commentaire:
Enregistrer un commentaire