diff --git a/sourcecode/hub/app/Http/Requests/ContentFilter.php b/sourcecode/hub/app/Http/Requests/ContentFilter.php index 5108539a2..00747cdac 100644 --- a/sourcecode/hub/app/Http/Requests/ContentFilter.php +++ b/sourcecode/hub/app/Http/Requests/ContentFilter.php @@ -312,8 +312,13 @@ private function attachModel(array $hits, bool $forUser, bool $showDrafts): Coll $eagerLoad[] = 'latestPublishedVersion'; } + $hitIds = collect($hits) + ->pluck('id') + ->filter + ->all(); + /** @phpstan-ignore-next-line */ - $contents = Content::whereIn('id', $hits->pluck('id')) + $contents = Content::whereIn('id', $hitIds) ->with($eagerLoad) ->withCount(['views']) ->get()