- return $entities;
- }
-
- protected function loadBooksForChildren(Collection $entities): void
- {
- $bookChildren = $entities->filter(fn(Entity $entity) => $entity instanceof BookChild);
- $eloquent = (new \Illuminate\Database\Eloquent\Collection($bookChildren));
- $eloquent->load(['book' => function (BelongsTo $query) {
- $query->scopes('visible');
- }]);