Skip to content

Commit 057554a

Browse files
Tofandelifox
authored andcommitted
fix: model not implementing has media should only throw exception if no custom callback is provided
1 parent 402dcf5 commit 057554a

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Http/Controllers/Admin/FeaturedController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ private function getFeaturedSources(Request $request, $featuredSection, $search
164164
($bucketable['scopes'] ?? []) + ($scopes ?? []),
165165
$bucketable['orders'] ?? [],
166166
$bucketable['per_page'] ?? $request->get('offset') ?? 10,
167-
$forcePagination = true
167+
true
168168
)->appends('bucketable', $module);
169169

170170
$fetchedModules[$module] = $items;

src/Services/Listings/Columns/Image.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ public function toColumnArray(array $visibleColumns = [], bool $sortable = true)
7272

7373
protected function getRenderValue(TwillModelContract $model): string
7474
{
75-
if (!classHasTrait($model::class, HasMedias::class)) {
76-
throw new InvalidArgumentException('Cannot use image column on model not implementing HasMedias trait');
77-
}
78-
7975
if ($renderFunction = $this->render) {
8076
return $renderFunction($model);
8177
}
8278

79+
if (!classHasTrait($model::class, HasMedias::class)) {
80+
throw new InvalidArgumentException('Cannot use image column on model not implementing HasMedias trait');
81+
}
82+
8383
return $this->getThumbnail($model);
8484
}
8585

0 commit comments

Comments
 (0)