From f458111743e5a91aab55f314278f14185362ce70 Mon Sep 17 00:00:00 2001 From: Ash Monsh Date: Thu, 19 Oct 2023 19:52:49 +0300 Subject: [PATCH] fix when using with multiple panels --- .../NavigationResource/Pages/CreateNavigation.php | 8 +++++++- .../Resources/NavigationResource/Pages/EditNavigation.php | 8 +++++++- .../NavigationResource/Pages/ListNavigations.php | 8 +++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/Filament/Resources/NavigationResource/Pages/CreateNavigation.php b/src/Filament/Resources/NavigationResource/Pages/CreateNavigation.php index 57aec0e..fdb8ebb 100644 --- a/src/Filament/Resources/NavigationResource/Pages/CreateNavigation.php +++ b/src/Filament/Resources/NavigationResource/Pages/CreateNavigation.php @@ -2,7 +2,9 @@ namespace RyanChandler\FilamentNavigation\Filament\Resources\NavigationResource\Pages; +use Filament\Facades\Filament; use Filament\Resources\Pages\CreateRecord; +use RyanChandler\FilamentNavigation\Filament\Resources\NavigationResource; use RyanChandler\FilamentNavigation\Filament\Resources\NavigationResource\Pages\Concerns\HandlesNavigationBuilder; use RyanChandler\FilamentNavigation\FilamentNavigation; @@ -12,6 +14,10 @@ class CreateNavigation extends CreateRecord public static function getResource(): string { - return FilamentNavigation::get()->getResource(); + if (Filament::hasPlugin('navigation')) { + return FilamentNavigation::get()->getResource(); + } + + return NavigationResource::class; } } diff --git a/src/Filament/Resources/NavigationResource/Pages/EditNavigation.php b/src/Filament/Resources/NavigationResource/Pages/EditNavigation.php index 2821afe..55e1ca7 100644 --- a/src/Filament/Resources/NavigationResource/Pages/EditNavigation.php +++ b/src/Filament/Resources/NavigationResource/Pages/EditNavigation.php @@ -2,7 +2,9 @@ namespace RyanChandler\FilamentNavigation\Filament\Resources\NavigationResource\Pages; +use Filament\Facades\Filament; use Filament\Resources\Pages\EditRecord; +use RyanChandler\FilamentNavigation\Filament\Resources\NavigationResource; use RyanChandler\FilamentNavigation\Filament\Resources\NavigationResource\Pages\Concerns\HandlesNavigationBuilder; use RyanChandler\FilamentNavigation\FilamentNavigation; @@ -12,6 +14,10 @@ class EditNavigation extends EditRecord public static function getResource(): string { - return FilamentNavigation::get()->getResource(); + if (Filament::hasPlugin('navigation')) { + return FilamentNavigation::get()->getResource(); + } + + return NavigationResource::class; } } diff --git a/src/Filament/Resources/NavigationResource/Pages/ListNavigations.php b/src/Filament/Resources/NavigationResource/Pages/ListNavigations.php index 9d6876c..69a6218 100644 --- a/src/Filament/Resources/NavigationResource/Pages/ListNavigations.php +++ b/src/Filament/Resources/NavigationResource/Pages/ListNavigations.php @@ -3,14 +3,20 @@ namespace RyanChandler\FilamentNavigation\Filament\Resources\NavigationResource\Pages; use Filament\Actions\CreateAction; +use Filament\Facades\Filament; use Filament\Resources\Pages\ListRecords; +use RyanChandler\FilamentNavigation\Filament\Resources\NavigationResource; use RyanChandler\FilamentNavigation\FilamentNavigation; class ListNavigations extends ListRecords { public static function getResource(): string { - return FilamentNavigation::get()->getResource(); + if (Filament::hasPlugin('navigation')) { + return FilamentNavigation::get()->getResource(); + } + + return NavigationResource::class; } protected function getActions(): array