Added
-
One hook for every action that deletes media.
Curator::configureDeleteActionsUsing()configures the resource table's row and bulk delete actions, the edit page's delete action, and the picker panel's delete action. Use it to add a warning or a guard without a globalDeleteAction::configureUsing(). Call it from a service provider'sboot()method:use Awcodes\Curator\Facades\Curator; use Awcodes\Curator\Models\Media; use Filament\Actions\Action; Curator::configureDeleteActionsUsing(function (Action $action): void { $action->modalDescription(fn (?Media $record) => "Delete {$record?->name}? It may still be in use."); });
The callback receives the Filament action, so any action method works, including
before()with$action->halt(). Single-record actions receive the media as$recordand the bulk action receives$records. Type$recordas nullable: the picker panel only resolves it once the delete dialog opens, and not at all if the user may not delete that item. If you have replaced the resource's page or table classes, pass your delete actions throughCurator::configureDeleteAction()to pick up the hook. See Customising delete actions.
Fixed
- Bulk delete now checks the media policy for each record. Filament authorizes bulk actions only through
deleteAny(). If your policy restricteddelete()on individual records but didn't definedeleteAny(), bulk delete from the media table removed records the policy denies. Each selected record is now checked. Records the user may not delete are skipped, and Filament reports a partial delete.
Added in #739, with tests for each delete path.
Filament 4 users are covered: 5.x serves both majors.