action groups for dynamic data
This commit is contained in:
1 parent
a980ea92ce
commit
37723a52eb
4 files changed
+62
-46
No files matched your search
@@ -8,6 +8,7 @@ use App\Models\ElementGroup;
|
||||
use App\Models\ElementProvider;
|
||||
use App\Models\Event;
|
||||
use App\Models\Sport;
|
||||
use Filament\Actions\ActionGroup;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
@@ -83,21 +84,24 @@ class ElementsTable
|
||||
], layout: FiltersLayout::AboveContent)
|
||||
->deferFilters(false)
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make()
|
||||
->tooltip('All elements connected to this group, including active events, will be deleted')
|
||||
->before(function ($record) {
|
||||
Event::where('home_id', $record->id)->delete();
|
||||
Event::where('away_id', $record->id)->delete();
|
||||
ElementProvider::where('element_id', $record->id)->delete();
|
||||
ElementGroup::where('element_id', $record->id)->delete();
|
||||
})
|
||||
->successNotification(
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Element deleted')
|
||||
->body('The element with all relations in other tables has been deleted successfully.'),
|
||||
),
|
||||
ActionGroup::make([
|
||||
EditAction::make(),
|
||||
DeleteAction::make()
|
||||
->tooltip('All elements connected to this group, including active events, will be deleted')
|
||||
->before(function ($record) {
|
||||
Event::where('home_id', $record->id)->delete();
|
||||
Event::where('away_id', $record->id)->delete();
|
||||
ElementProvider::where('element_id', $record->id)->delete();
|
||||
ElementGroup::where('element_id', $record->id)->delete();
|
||||
})
|
||||
->successNotification(
|
||||
Notification::make()
|
||||
->success()
|
||||
->title('Element deleted')
|
||||
->body('The element with all relations in other tables has been deleted successfully.'),
|
||||
),
|
||||
])->iconButton()
|
||||
->icon('phosphor-dots-three-vertical'),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
|
||||
Reference in new issue
Block a user