Skip to content

Commit

Permalink
fix get page image and multiple panels
Browse files Browse the repository at this point in the history
  • Loading branch information
atmonshi committed Oct 18, 2023
1 parent 240ffa7 commit 9941e96
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ public function parent(): BelongsTo
return $this->belongsTo(self::class, 'parent_id', 'id');
}

public function image(): Collection | string | null
public function image(string $collection = 'posts'): Collection | string | null
{
if (! $this->getMedia('posts')->isEmpty()) {
return $this->getFirstMediaUrl('posts');
if (! $this->getMedia($collection)->isEmpty()) {
return $this->getFirstMediaUrl($collection);
} else {
return $this->featured_image ?? config('zeus-sky.defaultFeaturedImage');
}
Expand Down
11 changes: 7 additions & 4 deletions src/SkyServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,14 @@ protected function getMigrations(): array

private function bootFilamentNavigation(): void
{
if (! defined('__PHPSTAN_RUNNING__') && (! app('filament')->hasPlugin('zeus-sky') || ! app('filament')->hasPlugin('navigation'))) {
return;
}

Filament::serving(function () {
if (! defined('__PHPSTAN_RUNNING__') &&
! app('filament')->hasPlugin('zeus-sky') &&
! app('filament')->hasPlugin('navigation')
) {
return;
}

NavigationResource::navigationGroup(SkyPlugin::get()->getNavigationGroupLabel());
NavigationResource::navigationSort(999);
NavigationResource::navigationIcon('heroicon-o-queue-list');
Expand Down

0 comments on commit 9941e96

Please sign in to comment.