I have a User model that does have many Networks. Each Network does have many Lists.
I have this code in the User model that is really slow:
foreach ($this->networks as $network) {
if ($myCondition) {
foreach ($network->lists()->get()->lists('id')->toArray() as $newId) {
$ids[] = $newId;
}
}
}
I wonder if there is a way to load all lists of all networks before the 2 foreach loops.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2AsiwgQ
via IFTTT
Aucun commentaire:
Enregistrer un commentaire