From 9941e966826842f577cb74cd61331acef4352e13 Mon Sep 17 00:00:00 2001 From: Ash Monsh Date: Wed, 18 Oct 2023 19:53:26 +0300 Subject: [PATCH] fix get page image and multiple panels --- src/Models/Post.php | 6 +++--- src/SkyServiceProvider.php | 11 +++++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/Models/Post.php b/src/Models/Post.php index efba03b..d2ab738 100644 --- a/src/Models/Post.php +++ b/src/Models/Post.php @@ -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'); } diff --git a/src/SkyServiceProvider.php b/src/SkyServiceProvider.php index ca7b6f8..685fd17 100644 --- a/src/SkyServiceProvider.php +++ b/src/SkyServiceProvider.php @@ -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');