Delete Actions
Filament provides multiple ways to delete records:- Single delete - Delete button on Edit/View pages
- Bulk delete - Select multiple records and delete them at once
- Table row delete - Delete action in table rows
Deleting from Edit/View Pages
Add a delete action to the page header:Deleting from the List Page
Delete individual records from the table:Bulk Delete
Bulk delete is available by default through toolbar actions:Soft Deletes
Laravel’s soft delete functionality allows “deleting” records without actually removing them from the database.Creating a Resource with Soft Deletes
- Force delete actions
- Restore actions
- Trashed filter
Adding Soft Deletes to Existing Resources
1
Update the table
2
Update Edit page
Soft Delete Actions
- Delete
- Force Delete
- Restore
Soft deletes the record:The record can still be restored.
Trashed Filter
The trashed filter allows users to view:- Active records only (default)
- Trashed records only
- All records (active and trashed)
Authorization
Filament observes model policy methods for delete operations:Single Delete
Bulk Delete
Filament uses
deleteAny() for bulk operations because checking delete() for each record is not performant.Check Individual Records in Bulk Delete
To check thedelete() policy for each record:
Force Delete Authorization
Restore Authorization
Customizing Delete Actions
Confirmation Modal
Customize the delete confirmation:Requiring Confirmation
Require the user to type a word:Success Notification
Before/After Hooks
Bulk Delete Performance
By default, bulk delete loads all records into memory to:- Authorize each record individually (when using
authorizeIndividualRecords()) - Fire model events (
deleting,deleted)