Skip to content

Commit c0783fc

Browse files
authored
Merge pull request #171 from lara-zeus/fixes
fix get page image and multiple panels
2 parents 49aa066 + 9941e96 commit c0783fc

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/Models/Post.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ public function parent(): BelongsTo
100100
return $this->belongsTo(self::class, 'parent_id', 'id');
101101
}
102102

103-
public function image(): Collection | string | null
103+
public function image(string $collection = 'posts'): Collection | string | null
104104
{
105-
if (! $this->getMedia('posts')->isEmpty()) {
106-
return $this->getFirstMediaUrl('posts');
105+
if (! $this->getMedia($collection)->isEmpty()) {
106+
return $this->getFirstMediaUrl($collection);
107107
} else {
108108
return $this->featured_image ?? config('zeus-sky.defaultFeaturedImage');
109109
}

src/SkyServiceProvider.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,14 @@ protected function getMigrations(): array
6464

6565
private function bootFilamentNavigation(): void
6666
{
67-
if (! defined('__PHPSTAN_RUNNING__') && (! app('filament')->hasPlugin('zeus-sky') || ! app('filament')->hasPlugin('navigation'))) {
68-
return;
69-
}
70-
7167
Filament::serving(function () {
68+
if (! defined('__PHPSTAN_RUNNING__') &&
69+
! app('filament')->hasPlugin('zeus-sky') &&
70+
! app('filament')->hasPlugin('navigation')
71+
) {
72+
return;
73+
}
74+
7275
NavigationResource::navigationGroup(SkyPlugin::get()->getNavigationGroupLabel());
7376
NavigationResource::navigationSort(999);
7477
NavigationResource::navigationIcon('heroicon-o-queue-list');

0 commit comments

Comments
 (0)