BulkAction class extends the Action class to provide functionality for performing operations on multiple selected records in a table. Bulk actions automatically handle record selection and provide access to the selected records.
Namespace
Inheritance
Extends:Filament\Actions\Action
Overview
BulkAction is a specialized version of Action that is automatically configured to:- Work with multiple selected records
- Only display when records are selected
- Provide access to selected records in closures
Static Methods
make()
Create a new bulk action instance.string | null
The unique identifier for this bulk action.
static
Returns the bulk action instance for method chaining.
Automatic Configuration
When a BulkAction is created, it is automatically configured with:- The action is marked as a bulk action
- The action has access to selected records
- The action is only visible when records are selected
Instance Methods
getExtraAttributes()
Get extra HTML attributes for the bulk action.array<mixed>
Returns an array of HTML attributes.
x-cloak- Hide until Alpine.js loadsx-show="getSelectedRecordsCount()"- Only show when records are selected
Working with Selected Records
Bulk action closures automatically receive the selected records:Using Collection Parameter
Using records Parameter Name
Using selectedRecords Parameter Name
Form Integration
Bulk actions can include forms to collect additional data:Confirmation
Bulk actions commonly require confirmation:Authorization
Authorize bulk actions based on the selected records:Notifications
Show notifications after bulk actions:Deselecting Records
Automatically deselect records after the action completes:Complete Example
Common Patterns
Batch Delete
Batch Update
Export Selected
Send Notifications
Closure Parameters
Bulk action closures receive:Collection
The selected records as an Eloquent collection.
Collection
Alias for records parameter.
array
Form data from the action modal (if a form is present).
Component
The parent Livewire component.
Table
The table instance.
Inherited Methods
BulkAction inherits all methods from the Action class, including:label()- Set the action labelicon()- Set the action iconcolor()- Set the action colorrequiresConfirmation()- Require confirmationform()- Add a form to the modalaction()- Set the callback to executebefore()- Execute before the actionafter()- Execute after the actionsuccessNotification()- Show success notificationauthorize()- Authorize the actionhidden()- Hide the action conditionallydisabled()- Disable the action conditionally