From 5424038b37b30eaa7d90bdc4e28ea86cf18541c2 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Fri, 22 Aug 2025 14:29:21 +0100 Subject: [PATCH 1/3] Pluck collectionHandle not collection --- src/Entries/EntryQueryBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Entries/EntryQueryBuilder.php b/src/Entries/EntryQueryBuilder.php index 2bec7f03..43c0b3b1 100644 --- a/src/Entries/EntryQueryBuilder.php +++ b/src/Entries/EntryQueryBuilder.php @@ -145,7 +145,7 @@ private function ensureCollectionsAreQueriedForStatusQuery(): void // If no IDs were queried, fall back to all collections. $ids->isEmpty() ? $this->whereIn('collection', Collection::handles()) - : $this->whereIn('collection', app(static::class)->whereIn('id', $ids)->pluck('collection')->unique()->values()); + : $this->whereIn('collection', app(static::class)->whereIn('id', $ids)->pluck('collectionHandle')->unique()->values()); } private function getCollectionsForStatusQuery(): \Illuminate\Support\Collection From bd6cbd8aca57320c707583dbff2b0413053a77f5 Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Fri, 22 Aug 2025 15:01:05 +0100 Subject: [PATCH 2/3] Fixes --- src/Entries/EntryQueryBuilder.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Entries/EntryQueryBuilder.php b/src/Entries/EntryQueryBuilder.php index 43c0b3b1..bba34879 100644 --- a/src/Entries/EntryQueryBuilder.php +++ b/src/Entries/EntryQueryBuilder.php @@ -141,11 +141,11 @@ private function ensureCollectionsAreQueriedForStatusQuery(): void // Otherwise, we'll detect them by looking at where clauses targeting the "id" column. $ids = $wheres->where('column', 'id')->flatMap(fn ($where) => $where['values'] ?? [$where['value']]); - + // If no IDs were queried, fall back to all collections. $ids->isEmpty() ? $this->whereIn('collection', Collection::handles()) - : $this->whereIn('collection', app(static::class)->whereIn('id', $ids)->pluck('collectionHandle')->unique()->values()); + : $this->whereIn('collection', app(static::class)->whereIn('id', $ids)->pluck('collection')->map(fn ($collection) => $collection?->handle)->filter()->unique()->values()); } private function getCollectionsForStatusQuery(): \Illuminate\Support\Collection @@ -221,7 +221,7 @@ protected function getJsonCasts(): IlluminateCollection || ! isset($collectionWhere['value']) || ! ($collection = Collection::find($collectionWhere['value'])) ) { - return []; + return collect([]); } return $collection->entryBlueprints() From a3c8113bd538fcb97878f34a09785fcd3942691e Mon Sep 17 00:00:00 2001 From: Ryan Mitchell Date: Fri, 22 Aug 2025 15:02:43 +0100 Subject: [PATCH 3/3] :beer: --- src/Entries/EntryQueryBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Entries/EntryQueryBuilder.php b/src/Entries/EntryQueryBuilder.php index bba34879..fcf9e016 100644 --- a/src/Entries/EntryQueryBuilder.php +++ b/src/Entries/EntryQueryBuilder.php @@ -141,7 +141,7 @@ private function ensureCollectionsAreQueriedForStatusQuery(): void // Otherwise, we'll detect them by looking at where clauses targeting the "id" column. $ids = $wheres->where('column', 'id')->flatMap(fn ($where) => $where['values'] ?? [$where['value']]); - + // If no IDs were queried, fall back to all collections. $ids->isEmpty() ? $this->whereIn('collection', Collection::handles())