Skip to content

Commit

Permalink
fix: eager loading can fail
Browse files Browse the repository at this point in the history
  • Loading branch information
SychO9 committed Dec 12, 2023
1 parent ecb6b5c commit 91ab098
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/LoadActorVoteRelationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ public static function sumRelation($controller, $data): void
return $post instanceof Post;
});
} elseif ($data instanceof Collection) {
$loadable = $data->map(function ($model) {
$loadable = (new Post())->newCollection($data->map(function ($model) {
return $model instanceof Discussion ? ($model->mostRelevantPost ?? $model->firstPost) : $model;
});
}));
} elseif ($data instanceof Post) {
$loadable = $data->newCollection([$data]);
}
Expand Down

0 comments on commit 91ab098

Please sign in to comment.