Skip to content

Commit

Permalink
Fix Author#previewItems query
Browse files Browse the repository at this point in the history
  • Loading branch information
eronisko committed Mar 9, 2024
1 parent a90a412 commit a5ec6e1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/Authority.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit a5ec6e1

Please sign in to comment.