© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•4mo ago•
1 reply
BBQfun

Prevent table DeleteBulkAction to delete admin

does any Filament 4 built-in method doing like this?
return $table
    ->toolbarActions([
        BulkActionGroup::make([
            DeleteBulkAction::make()
                ->using(function (Component $livewire, Collection $records) {
                    $records->each(function (User $record) {
                        if (Gate::allows('delete', $record)) {
                            $record->delete();
                        }
                    });

                    $livewire->dispatch('refresh-sidebar');
                }),
            ForceDeleteBulkAction::make(),
            RestoreBulkAction::make(),
        ]),
    ]);
return $table
    ->toolbarActions([
        BulkActionGroup::make([
            DeleteBulkAction::make()
                ->using(function (Component $livewire, Collection $records) {
                    $records->each(function (User $record) {
                        if (Gate::allows('delete', $record)) {
                            $record->delete();
                        }
                    });

                    $livewire->dispatch('refresh-sidebar');
                }),
            ForceDeleteBulkAction::make(),
            RestoreBulkAction::make(),
        ]),
    ]);
firefox_PfG3CBnB3H.gif
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

DeleteBulkAction do not check for delete_any policy
FilamentFFilament / ❓┊help
2mo ago
Change de delete process in Tables\Actions\DeleteBulkAction Hooks
FilamentFFilament / ❓┊help
3y ago
DeleteBulkAction and ForceDeleteBulkAction policies
FilamentFFilament / ❓┊help
2y ago
Prevent Logout when changing Admin Password?
FilamentFFilament / ❓┊help
3y ago