页面 · Laravilt
BulkAction
Build custom actions that run on multiple selected records.
Name the first closure parameter $records to receive the selected models as a collection, or $ids for just their keys. $data holds modal form values.
php
BulkAction requires confirmation by default. Customize the modal with modalHeading() and modalDescription(), or turn it off with requiresConfirmation(false).
With a form
php
Deselect after completion
Custom bulk actions keep the selection by default. The built-in delete/restore bulk actions clear it.
php
API reference
| Method | Description |
|---|---|
action(Closure) | Handler receiving $records / $ids and $data |
form() / schema() | Modal form |
requiresConfirmation(), modalHeading(), modalDescription() | Confirmation |
deselectRecordsAfterCompletion() | Clear selection when done (default false) |
label(), icon(), color() | Appearance |