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
+19
-15
@@ -8,6 +8,7 @@ use App\Models\ElementGroup;
|
|||||||
use App\Models\Event;
|
use App\Models\Event;
|
||||||
use App\Models\Group;
|
use App\Models\Group;
|
||||||
use App\Models\Sport;
|
use App\Models\Sport;
|
||||||
|
use Filament\Actions\ActionGroup;
|
||||||
use Filament\Actions\BulkActionGroup;
|
use Filament\Actions\BulkActionGroup;
|
||||||
use Filament\Actions\DeleteAction;
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Actions\DeleteBulkAction;
|
use Filament\Actions\DeleteBulkAction;
|
||||||
@@ -60,21 +61,24 @@ class CompetitionGroupsTable
|
|||||||
], layout: FiltersLayout::AboveContent)
|
], layout: FiltersLayout::AboveContent)
|
||||||
->deferFilters(false)
|
->deferFilters(false)
|
||||||
->recordActions([
|
->recordActions([
|
||||||
EditAction::make(),
|
ActionGroup::make([
|
||||||
DeleteAction::make()
|
EditAction::make(),
|
||||||
->tooltip('All elements connected to this group, including active events, will be deleted')
|
DeleteAction::make()
|
||||||
->before(function ($record) {
|
->tooltip('All elements connected to this group, including active events, will be deleted')
|
||||||
Group::where('competition_group_id', $record->id)->delete();
|
->before(function ($record) {
|
||||||
Event::where('competition_group_id', $record->id)->delete();
|
Group::where('competition_group_id', $record->id)->delete();
|
||||||
ElementGroup::where('competition_group_id', $record->id)->delete();
|
Event::where('competition_group_id', $record->id)->delete();
|
||||||
CompetitionGroupProvider::where('competition_group_id', $record->id)->delete();
|
ElementGroup::where('competition_group_id', $record->id)->delete();
|
||||||
})
|
CompetitionGroupProvider::where('competition_group_id', $record->id)->delete();
|
||||||
->successNotification(
|
})
|
||||||
Notification::make()
|
->successNotification(
|
||||||
->success()
|
Notification::make()
|
||||||
->title('Group deleted')
|
->success()
|
||||||
->body('The group and all relations has been deleted successfully.'),
|
->title('Group deleted')
|
||||||
),
|
->body('The group and all relations has been deleted successfully.'),
|
||||||
|
),
|
||||||
|
])->iconButton()
|
||||||
|
->icon('phosphor-dots-three-vertical'),
|
||||||
])
|
])
|
||||||
->toolbarActions([
|
->toolbarActions([
|
||||||
BulkActionGroup::make([
|
BulkActionGroup::make([
|
||||||
|
|||||||
+12
-8
@@ -6,6 +6,7 @@ use App\Models\AddByMethod;
|
|||||||
use App\Models\Country;
|
use App\Models\Country;
|
||||||
use App\Models\Provider;
|
use App\Models\Provider;
|
||||||
use App\Models\Sport;
|
use App\Models\Sport;
|
||||||
|
use Filament\Actions\ActionGroup;
|
||||||
use Filament\Actions\BulkActionGroup;
|
use Filament\Actions\BulkActionGroup;
|
||||||
use Filament\Actions\DeleteAction;
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Actions\DeleteBulkAction;
|
use Filament\Actions\DeleteBulkAction;
|
||||||
@@ -75,14 +76,17 @@ class CompetitonGroupProvidersTable
|
|||||||
], layout: FiltersLayout::AboveContent)
|
], layout: FiltersLayout::AboveContent)
|
||||||
->deferFilters(false)
|
->deferFilters(false)
|
||||||
->recordActions([
|
->recordActions([
|
||||||
EditAction::make(),
|
ActionGroup::make([
|
||||||
DeleteAction::make()
|
EditAction::make(),
|
||||||
->successNotification(
|
DeleteAction::make()
|
||||||
Notification::make()
|
->successNotification(
|
||||||
->success()
|
Notification::make()
|
||||||
->title('Group deleted')
|
->success()
|
||||||
->body('The provider group has been deleted successfully.'),
|
->title('Group deleted')
|
||||||
),
|
->body('The provider group has been deleted successfully.'),
|
||||||
|
),
|
||||||
|
])->iconButton()
|
||||||
|
->icon('phosphor-dots-three-vertical'),
|
||||||
])
|
])
|
||||||
->toolbarActions([
|
->toolbarActions([
|
||||||
BulkActionGroup::make([
|
BulkActionGroup::make([
|
||||||
|
|||||||
+12
-8
@@ -6,6 +6,7 @@ use App\Models\AddByMethod;
|
|||||||
use App\Models\Country;
|
use App\Models\Country;
|
||||||
use App\Models\Provider;
|
use App\Models\Provider;
|
||||||
use App\Models\Sport;
|
use App\Models\Sport;
|
||||||
|
use Filament\Actions\ActionGroup;
|
||||||
use Filament\Actions\BulkActionGroup;
|
use Filament\Actions\BulkActionGroup;
|
||||||
use Filament\Actions\DeleteAction;
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Actions\DeleteBulkAction;
|
use Filament\Actions\DeleteBulkAction;
|
||||||
@@ -72,14 +73,17 @@ class ElementProvidersTable
|
|||||||
], layout: FiltersLayout::AboveContent)
|
], layout: FiltersLayout::AboveContent)
|
||||||
->deferFilters(false)
|
->deferFilters(false)
|
||||||
->recordActions([
|
->recordActions([
|
||||||
EditAction::make(),
|
ActionGroup::make([
|
||||||
DeleteAction::make()
|
EditAction::make(),
|
||||||
->successNotification(
|
DeleteAction::make()
|
||||||
Notification::make()
|
->successNotification(
|
||||||
->success()
|
Notification::make()
|
||||||
->title('Element deleted')
|
->success()
|
||||||
->body('The provider element has been deleted successfully.'),
|
->title('Element deleted')
|
||||||
),
|
->body('The provider element has been deleted successfully.'),
|
||||||
|
),
|
||||||
|
])->iconButton()
|
||||||
|
->icon('phosphor-dots-three-vertical'),
|
||||||
])
|
])
|
||||||
->toolbarActions([
|
->toolbarActions([
|
||||||
BulkActionGroup::make([
|
BulkActionGroup::make([
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ use App\Models\ElementGroup;
|
|||||||
use App\Models\ElementProvider;
|
use App\Models\ElementProvider;
|
||||||
use App\Models\Event;
|
use App\Models\Event;
|
||||||
use App\Models\Sport;
|
use App\Models\Sport;
|
||||||
|
use Filament\Actions\ActionGroup;
|
||||||
use Filament\Actions\BulkActionGroup;
|
use Filament\Actions\BulkActionGroup;
|
||||||
use Filament\Actions\DeleteAction;
|
use Filament\Actions\DeleteAction;
|
||||||
use Filament\Actions\DeleteBulkAction;
|
use Filament\Actions\DeleteBulkAction;
|
||||||
@@ -83,21 +84,24 @@ class ElementsTable
|
|||||||
], layout: FiltersLayout::AboveContent)
|
], layout: FiltersLayout::AboveContent)
|
||||||
->deferFilters(false)
|
->deferFilters(false)
|
||||||
->recordActions([
|
->recordActions([
|
||||||
EditAction::make(),
|
ActionGroup::make([
|
||||||
DeleteAction::make()
|
EditAction::make(),
|
||||||
->tooltip('All elements connected to this group, including active events, will be deleted')
|
DeleteAction::make()
|
||||||
->before(function ($record) {
|
->tooltip('All elements connected to this group, including active events, will be deleted')
|
||||||
Event::where('home_id', $record->id)->delete();
|
->before(function ($record) {
|
||||||
Event::where('away_id', $record->id)->delete();
|
Event::where('home_id', $record->id)->delete();
|
||||||
ElementProvider::where('element_id', $record->id)->delete();
|
Event::where('away_id', $record->id)->delete();
|
||||||
ElementGroup::where('element_id', $record->id)->delete();
|
ElementProvider::where('element_id', $record->id)->delete();
|
||||||
})
|
ElementGroup::where('element_id', $record->id)->delete();
|
||||||
->successNotification(
|
})
|
||||||
Notification::make()
|
->successNotification(
|
||||||
->success()
|
Notification::make()
|
||||||
->title('Element deleted')
|
->success()
|
||||||
->body('The element with all relations in other tables has been deleted successfully.'),
|
->title('Element deleted')
|
||||||
),
|
->body('The element with all relations in other tables has been deleted successfully.'),
|
||||||
|
),
|
||||||
|
])->iconButton()
|
||||||
|
->icon('phosphor-dots-three-vertical'),
|
||||||
])
|
])
|
||||||
->toolbarActions([
|
->toolbarActions([
|
||||||
BulkActionGroup::make([
|
BulkActionGroup::make([
|
||||||
|
|||||||
Reference in new issue
Block a user