How to use whereHas on multilevel relationship like:
$parentCats = Category::with( 'children', 'children.products', 'children.products.productDetails' );
Now I want to do query like:
$parentCats = $parentCats->whereHas( 'children.products.productDetails', function ($q2) use ($size) { $q2->where('size', '=', $size); } )->find($id);
this query is giving all data. But I want data only where productDetails have given size.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1pWK5Dp
via IFTTT
Aucun commentaire:
Enregistrer un commentaire