From 33db2e0f026318e3f2202fc68eb00a41d4d9f328 Mon Sep 17 00:00:00 2001 From: Ash Monsh Date: Sun, 3 Dec 2023 18:43:38 +0300 Subject: [PATCH] fix actions --- src/Filament/Resources/FaqResource.php | 10 ++++---- src/Filament/Resources/LibraryResource.php | 28 ++++++++++------------ src/Filament/Resources/PageResource.php | 25 +++++++++---------- src/Filament/Resources/PostResource.php | 24 +++++++++---------- 4 files changed, 38 insertions(+), 49 deletions(-) diff --git a/src/Filament/Resources/FaqResource.php b/src/Filament/Resources/FaqResource.php index 58ce627..57446cc 100644 --- a/src/Filament/Resources/FaqResource.php +++ b/src/Filament/Resources/FaqResource.php @@ -92,11 +92,9 @@ public static function table(Table $table): Table public static function getActions(): array { $action = [ - ActionGroup::make([ - EditAction::make('edit')->label(__('Edit')), - DeleteAction::make('delete') - ->label(__('Delete')), - ]), + EditAction::make('edit')->label(__('Edit')), + DeleteAction::make('delete') + ->label(__('Delete')), ]; if (class_exists(\LaraZeus\Helen\HelenServiceProvider::class)) { @@ -105,7 +103,7 @@ public static function getActions(): array ->distUrl(fn (): string => route('faq')); } - return $action; + return [ActionGroup::make($action)]; } public static function getPages(): array diff --git a/src/Filament/Resources/LibraryResource.php b/src/Filament/Resources/LibraryResource.php index 8b681de..0b6b9c8 100644 --- a/src/Filament/Resources/LibraryResource.php +++ b/src/Filament/Resources/LibraryResource.php @@ -145,9 +145,7 @@ public static function table(Table $table): Table ->toggleable() ->type('library'), ]) - ->actions([ - ActionGroup::make(static::getActions()), - ]) + ->actions(static::getActions()) ->filters([ SelectFilter::make('type') ->visible() @@ -189,18 +187,16 @@ public static function getNavigationLabel(): string public static function getActions(): array { $action = [ - ActionGroup::make([ - EditAction::make('edit') - ->label(__('Edit')), - Action::make('Open') - ->color('warning') - ->icon('heroicon-o-arrow-top-right-on-square') - ->label(__('Open')) - ->url(fn (Library $record): string => route('library.item', ['slug' => $record->slug])) - ->openUrlInNewTab(), - DeleteAction::make('delete') - ->label(__('Delete')), - ]), + EditAction::make('edit') + ->label(__('Edit')), + Action::make('Open') + ->color('warning') + ->icon('heroicon-o-arrow-top-right-on-square') + ->label(__('Open')) + ->url(fn (Library $record): string => route('library.item', ['slug' => $record->slug])) + ->openUrlInNewTab(), + DeleteAction::make('delete') + ->label(__('Delete')), ]; if (class_exists(\LaraZeus\Helen\HelenServiceProvider::class)) { @@ -209,6 +205,6 @@ public static function getActions(): array ->distUrl(fn (Library $record): string => route('library.item', ['slug' => $record->slug])); } - return $action; + return [ActionGroup::make($action)]; } } diff --git a/src/Filament/Resources/PageResource.php b/src/Filament/Resources/PageResource.php index 21c04a9..e2f5f2b 100644 --- a/src/Filament/Resources/PageResource.php +++ b/src/Filament/Resources/PageResource.php @@ -217,19 +217,16 @@ public static function getNavigationLabel(): string public static function getActions(): array { $action = [ - ActionGroup::make([ - EditAction::make('edit')->label(__('Edit')), - - Action::make('Open') - ->color('warning') - ->icon('heroicon-o-arrow-top-right-on-square') - ->label(__('Open')) - ->url(fn (Post $record): string => route('page', ['slug' => $record])) - ->openUrlInNewTab(), - DeleteAction::make('delete'), - ForceDeleteAction::make(), - RestoreAction::make(), - ]), + EditAction::make('edit')->label(__('Edit')), + Action::make('Open') + ->color('warning') + ->icon('heroicon-o-arrow-top-right-on-square') + ->label(__('Open')) + ->url(fn (Post $record): string => route('page', ['slug' => $record])) + ->openUrlInNewTab(), + DeleteAction::make('delete'), + ForceDeleteAction::make(), + RestoreAction::make(), ]; if (class_exists(\LaraZeus\Helen\HelenServiceProvider::class)) { @@ -238,6 +235,6 @@ public static function getActions(): array ->distUrl(fn (Post $record): string => route('page', ['slug' => $record])); } - return $action; + return [ActionGroup::make($action)]; } } diff --git a/src/Filament/Resources/PostResource.php b/src/Filament/Resources/PostResource.php index 363edf8..b0ed1bd 100644 --- a/src/Filament/Resources/PostResource.php +++ b/src/Filament/Resources/PostResource.php @@ -258,18 +258,16 @@ public static function getNavigationLabel(): string public static function getActions(): array { $action = [ - ActionGroup::make([ - EditAction::make('edit')->label(__('Edit')), - Action::make('Open') - ->color('warning') - ->icon('heroicon-o-arrow-top-right-on-square') - ->label(__('Open')) - ->url(fn (Post $record): string => route('post', ['slug' => $record])) - ->openUrlInNewTab(), - DeleteAction::make('delete'), - ForceDeleteAction::make(), - RestoreAction::make(), - ]), + EditAction::make('edit')->label(__('Edit')), + Action::make('Open') + ->color('warning') + ->icon('heroicon-o-arrow-top-right-on-square') + ->label(__('Open')) + ->url(fn (Post $record): string => route('post', ['slug' => $record])) + ->openUrlInNewTab(), + DeleteAction::make('delete'), + ForceDeleteAction::make(), + RestoreAction::make(), ]; if (class_exists(\LaraZeus\Helen\HelenServiceProvider::class)) { @@ -278,6 +276,6 @@ public static function getActions(): array ->distUrl(fn (Post $record): string => route('post', ['slug' => $record])); } - return $action; + return [ActionGroup::make($action)]; } }