Skip to main content
The 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.
Example:

Automatic Configuration

When a BulkAction is created, it is automatically configured with:
This means:
  • 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.
Bulk actions automatically include:
  • x-cloak - Hide until Alpine.js loads
  • x-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 label
  • icon() - Set the action icon
  • color() - Set the action color
  • requiresConfirmation() - Require confirmation
  • form() - Add a form to the modal
  • action() - Set the callback to execute
  • before() - Execute before the action
  • after() - Execute after the action
  • successNotification() - Show success notification
  • authorize() - Authorize the action
  • hidden() - Hide the action conditionally
  • disabled() - Disable the action conditionally