I have customer model and product model joined by subscriptions table. When i run something like $customers = Customer::with('products' => function($query) { $query->where('somecondition');});
And if i loop over customers like :
foreach ($customers as $customer){
foreach($customer->products as $product) {
# do something
}
}
It loads the entire products of the customer ignoring the condition above by using dynamic property.. How to fix this?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire