From a5ec6e14ee9581df6ca4444b5873470b59747ab8 Mon Sep 17 00:00:00 2001 From: Ernest Walzel Date: Sat, 9 Mar 2024 19:20:50 +0100 Subject: [PATCH] Fix Author#previewItems query --- app/Authority.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Authority.php b/app/Authority.php index b6b2fcc54..7b59046c6 100644 --- a/app/Authority.php +++ b/app/Authority.php @@ -6,6 +6,7 @@ use Chelout\RelationshipEvents\Concerns\HasBelongsToManyEvents; use Astrotomic\Translatable\Translatable; use Astrotomic\Translatable\Contracts\Translatable as TranslatableContract; +use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\DB; @@ -111,8 +112,9 @@ public function previewItems() { return $this->items() ->with('translations') - ->orWhere('has_image', true) - ->orWhereHas('images') + ->where(function (Builder $query) { + $query->where('has_image', true)->orWhereHas('images'); + }) ->orderBy('created_at', 'asc') ->limit(10); }