Skip to content

Commit

Permalink
Eager load all the related items at once
Browse files Browse the repository at this point in the history
  • Loading branch information
Tofandel committed Oct 15, 2024
1 parent a9a1d52 commit 63a7a4e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/Repositories/BlockRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function hydrate(TwillModelContract $model, array $fields): TwillModelCon
);

$model->setRelation('relatedItems', $relatedItems);
$model->loadMissing('relatedItems.related');

return parent::hydrate($model, $fields);
}
Expand Down

0 comments on commit 63a7a4e

Please sign in to comment.