Introduction
“Action” is a word that is used quite a bit within the Laravel community. Traditionally, action PHP classes handle “doing” something in your application’s business logic. For instance, logging a user in, sending an email, or creating a new user record in the database. In Filament, actions also handle “doing” something in your app. However, they are a bit different from traditional actions. They are designed to be used in the context of a user interface. For instance, you might have a button to delete a client record, which opens a modal to confirm your decision. When the user clicks the “Delete” button in the modal, the client is deleted. This whole workflow is an “action”.As well as $data, the action() function can inject various utilities as parameters.
$data, the action() function can inject various utilities as parameters.Learn more about utility injection.
Action
$action
Filament\Actions\Action
The current action instance.
Arguments
$arguments
array<string, mixed>
The array of arguments passed to the action when it was triggered.
Data
$data
array<string, mixed>
The array of data submitted from form fields in the action's modal. It will be empty before the modal form is submitted.
Livewire
$livewire
Livewire\Component
The Livewire component instance.
Eloquent model FQN
$model
?string<Illuminate\Database\Eloquent\Model>
The Eloquent model FQN for the current action, if one is attached.
Mounted actions
$mountedActions
array<Filament\Actions\Action>
The array of actions that are currently mounted in the Livewire component. This is useful for accessing data from parent actions.
Eloquent record
$record
?Illuminate\Database\Eloquent\Model
The Eloquent record for the current action, if one is attached.
Schema
$schema
Filament\Schemas\Schema
[Actions in schemas only] The schema object that this action belongs to.
Schema component
$schemaComponent
Filament\Schemas\Components\Component
[Actions in schemas only] The schema component that this action belongs to.
Schema component state
$schemaComponentState
mixed
[Actions in schemas only] The current value of the schema component.
Schema get function
$schemaGet
Filament\Schemas\Components\Utilities\Get
[Actions in schemas only] A function for retrieving values from the schema data. Validation is not run on form fields.
Schema operation
$schemaOperation
string
[Actions in schemas only] The current operation being performed by the schema. Usually
create, edit, or view.Schema set function
$schemaSet
Filament\Schemas\Components\Utilities\Set
[Actions in schemas only] A function for setting values in the schema data.
Schema state
$schemaState
mixed
[Actions in schemas only] The current value of the schema that this action belongs to, like the current repeater item.
Selected Eloquent records
$selectedRecords
Illuminate\Support\Collection
[Bulk actions only] The Eloquent records selected in the table.
Table
$table
Filament\Tables\Table
[Actions in tables only] The table object that this action belongs to.
As well as allowing a static value, the url() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.
url() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.Learn more about utility injection.
Action
$action
Filament\Actions\Action
The current action instance.
Arguments
$arguments
array<string, mixed>
The array of arguments passed to the action when it was triggered.
Data
$data
array<string, mixed>
The array of data submitted from form fields in the action's modal. It will be empty before the modal form is submitted.
Livewire
$livewire
Livewire\Component
The Livewire component instance.
Eloquent model FQN
$model
?string<Illuminate\Database\Eloquent\Model>
The Eloquent model FQN for the current action, if one is attached.
Mounted actions
$mountedActions
array<Filament\Actions\Action>
The array of actions that are currently mounted in the Livewire component. This is useful for accessing data from parent actions.
Eloquent record
$record
?Illuminate\Database\Eloquent\Model
The Eloquent record for the current action, if one is attached.
Schema
$schema
Filament\Schemas\Schema
[Actions in schemas only] The schema object that this action belongs to.
Schema component
$schemaComponent
Filament\Schemas\Components\Component
[Actions in schemas only] The schema component that this action belongs to.
Schema component state
$schemaComponentState
mixed
[Actions in schemas only] The current value of the schema component.
Schema get function
$schemaGet
Filament\Schemas\Components\Utilities\Get
[Actions in schemas only] A function for retrieving values from the schema data. Validation is not run on form fields.
Schema operation
$schemaOperation
string
[Actions in schemas only] The current operation being performed by the schema. Usually
create, edit, or view.Schema set function
$schemaSet
Filament\Schemas\Components\Utilities\Set
[Actions in schemas only] A function for setting values in the schema data.
Schema state
$schemaState
mixed
[Actions in schemas only] The current value of the schema that this action belongs to, like the current repeater item.
Selected Eloquent records
$selectedRecords
Illuminate\Support\Collection
[Bulk actions only] The Eloquent records selected in the table.
Table
$table
Filament\Tables\Table
[Actions in tables only] The table object that this action belongs to.
Available actions
Filament includes several actions that you can add to your app. Their aim is to simplify the most common Eloquent-related actions: You can also create your own actions to do anything, these are just common ones that we include out of the box.Choosing a trigger style
Out of the box, action triggers have 4 styles - “button”, “link”, “icon button”, and “badge”. “Button” triggers have a background color, label, and optionally an icon. Usually, this is the default button style, but you can use it manually with thebutton() method:
link() method:
iconButton() method:
badge() method:
Using an icon button on mobile devices only
You may want to use a button style with a label on desktop, but remove the label on mobile. This will transform it into an icon button. You can do this with thelabeledFrom() method, passing in the responsive breakpoint at which you want the label to be added to the button:
Setting a label
By default, the label of the trigger button is generated from its name. You may customize this using thelabel() method:
As well as allowing a static value, the label() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.
label() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.Learn more about utility injection.
Action
$action
Filament\Actions\Action
The current action instance.
Arguments
$arguments
array<string, mixed>
The array of arguments passed to the action when it was triggered.
Data
$data
array<string, mixed>
The array of data submitted from form fields in the action's modal. It will be empty before the modal form is submitted.
Livewire
$livewire
Livewire\Component
The Livewire component instance.
Eloquent model FQN
$model
?string<Illuminate\Database\Eloquent\Model>
The Eloquent model FQN for the current action, if one is attached.
Mounted actions
$mountedActions
array<Filament\Actions\Action>
The array of actions that are currently mounted in the Livewire component. This is useful for accessing data from parent actions.
Eloquent record
$record
?Illuminate\Database\Eloquent\Model
The Eloquent record for the current action, if one is attached.
Schema
$schema
Filament\Schemas\Schema
[Actions in schemas only] The schema object that this action belongs to.
Schema component
$schemaComponent
Filament\Schemas\Components\Component
[Actions in schemas only] The schema component that this action belongs to.
Schema component state
$schemaComponentState
mixed
[Actions in schemas only] The current value of the schema component.
Schema get function
$schemaGet
Filament\Schemas\Components\Utilities\Get
[Actions in schemas only] A function for retrieving values from the schema data. Validation is not run on form fields.
Schema operation
$schemaOperation
string
[Actions in schemas only] The current operation being performed by the schema. Usually
create, edit, or view.Schema set function
$schemaSet
Filament\Schemas\Components\Utilities\Set
[Actions in schemas only] A function for setting values in the schema data.
Schema state
$schemaState
mixed
[Actions in schemas only] The current value of the schema that this action belongs to, like the current repeater item.
Selected Eloquent records
$selectedRecords
Illuminate\Support\Collection
[Bulk actions only] The Eloquent records selected in the table.
Table
$table
Filament\Tables\Table
[Actions in tables only] The table object that this action belongs to.
Setting a color
Buttons may have a color to indicate their significance:As well as allowing a static value, the color() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.
color() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.Learn more about utility injection.
Action
$action
Filament\Actions\Action
The current action instance.
Arguments
$arguments
array<string, mixed>
The array of arguments passed to the action when it was triggered.
Data
$data
array<string, mixed>
The array of data submitted from form fields in the action's modal. It will be empty before the modal form is submitted.
Livewire
$livewire
Livewire\Component
The Livewire component instance.
Eloquent model FQN
$model
?string<Illuminate\Database\Eloquent\Model>
The Eloquent model FQN for the current action, if one is attached.
Mounted actions
$mountedActions
array<Filament\Actions\Action>
The array of actions that are currently mounted in the Livewire component. This is useful for accessing data from parent actions.
Eloquent record
$record
?Illuminate\Database\Eloquent\Model
The Eloquent record for the current action, if one is attached.
Schema
$schema
Filament\Schemas\Schema
[Actions in schemas only] The schema object that this action belongs to.
Schema component
$schemaComponent
Filament\Schemas\Components\Component
[Actions in schemas only] The schema component that this action belongs to.
Schema component state
$schemaComponentState
mixed
[Actions in schemas only] The current value of the schema component.
Schema get function
$schemaGet
Filament\Schemas\Components\Utilities\Get
[Actions in schemas only] A function for retrieving values from the schema data. Validation is not run on form fields.
Schema operation
$schemaOperation
string
[Actions in schemas only] The current operation being performed by the schema. Usually
create, edit, or view.Schema set function
$schemaSet
Filament\Schemas\Components\Utilities\Set
[Actions in schemas only] A function for setting values in the schema data.
Schema state
$schemaState
mixed
[Actions in schemas only] The current value of the schema that this action belongs to, like the current repeater item.
Selected Eloquent records
$selectedRecords
Illuminate\Support\Collection
[Bulk actions only] The Eloquent records selected in the table.
Table
$table
Filament\Tables\Table
[Actions in tables only] The table object that this action belongs to.
Setting a size
Buttons come in 3 sizes -Size::Small, Size::Medium or Size::Large. You can change the size of the action’s trigger using the size() method:
As well as allowing a static value, the size() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.
size() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.Learn more about utility injection.
Action
$action
Filament\Actions\Action
The current action instance.
Arguments
$arguments
array<string, mixed>
The array of arguments passed to the action when it was triggered.
Data
$data
array<string, mixed>
The array of data submitted from form fields in the action's modal. It will be empty before the modal form is submitted.
Livewire
$livewire
Livewire\Component
The Livewire component instance.
Eloquent model FQN
$model
?string<Illuminate\Database\Eloquent\Model>
The Eloquent model FQN for the current action, if one is attached.
Mounted actions
$mountedActions
array<Filament\Actions\Action>
The array of actions that are currently mounted in the Livewire component. This is useful for accessing data from parent actions.
Eloquent record
$record
?Illuminate\Database\Eloquent\Model
The Eloquent record for the current action, if one is attached.
Schema
$schema
Filament\Schemas\Schema
[Actions in schemas only] The schema object that this action belongs to.
Schema component
$schemaComponent
Filament\Schemas\Components\Component
[Actions in schemas only] The schema component that this action belongs to.
Schema component state
$schemaComponentState
mixed
[Actions in schemas only] The current value of the schema component.
Schema get function
$schemaGet
Filament\Schemas\Components\Utilities\Get
[Actions in schemas only] A function for retrieving values from the schema data. Validation is not run on form fields.
Schema operation
$schemaOperation
string
[Actions in schemas only] The current operation being performed by the schema. Usually
create, edit, or view.Schema set function
$schemaSet
Filament\Schemas\Components\Utilities\Set
[Actions in schemas only] A function for setting values in the schema data.
Schema state
$schemaState
mixed
[Actions in schemas only] The current value of the schema that this action belongs to, like the current repeater item.
Selected Eloquent records
$selectedRecords
Illuminate\Support\Collection
[Bulk actions only] The Eloquent records selected in the table.
Table
$table
Filament\Tables\Table
[Actions in tables only] The table object that this action belongs to.
Setting an icon
Buttons may have an icon to add more detail to the UI. You can set the icon using theicon() method:
As well as allowing a static value, the icon() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.
icon() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.Learn more about utility injection.
Action
$action
Filament\Actions\Action
The current action instance.
Arguments
$arguments
array<string, mixed>
The array of arguments passed to the action when it was triggered.
Data
$data
array<string, mixed>
The array of data submitted from form fields in the action's modal. It will be empty before the modal form is submitted.
Livewire
$livewire
Livewire\Component
The Livewire component instance.
Eloquent model FQN
$model
?string<Illuminate\Database\Eloquent\Model>
The Eloquent model FQN for the current action, if one is attached.
Mounted actions
$mountedActions
array<Filament\Actions\Action>
The array of actions that are currently mounted in the Livewire component. This is useful for accessing data from parent actions.
Eloquent record
$record
?Illuminate\Database\Eloquent\Model
The Eloquent record for the current action, if one is attached.
Schema
$schema
Filament\Schemas\Schema
[Actions in schemas only] The schema object that this action belongs to.
Schema component
$schemaComponent
Filament\Schemas\Components\Component
[Actions in schemas only] The schema component that this action belongs to.
Schema component state
$schemaComponentState
mixed
[Actions in schemas only] The current value of the schema component.
Schema get function
$schemaGet
Filament\Schemas\Components\Utilities\Get
[Actions in schemas only] A function for retrieving values from the schema data. Validation is not run on form fields.
Schema operation
$schemaOperation
string
[Actions in schemas only] The current operation being performed by the schema. Usually
create, edit, or view.Schema set function
$schemaSet
Filament\Schemas\Components\Utilities\Set
[Actions in schemas only] A function for setting values in the schema data.
Schema state
$schemaState
mixed
[Actions in schemas only] The current value of the schema that this action belongs to, like the current repeater item.
Selected Eloquent records
$selectedRecords
Illuminate\Support\Collection
[Bulk actions only] The Eloquent records selected in the table.
Table
$table
Filament\Tables\Table
[Actions in tables only] The table object that this action belongs to.
iconPosition() method:
As well as allowing a static value, the iconPosition() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.
iconPosition() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.Learn more about utility injection.
Action
$action
Filament\Actions\Action
The current action instance.
Arguments
$arguments
array<string, mixed>
The array of arguments passed to the action when it was triggered.
Data
$data
array<string, mixed>
The array of data submitted from form fields in the action's modal. It will be empty before the modal form is submitted.
Livewire
$livewire
Livewire\Component
The Livewire component instance.
Eloquent model FQN
$model
?string<Illuminate\Database\Eloquent\Model>
The Eloquent model FQN for the current action, if one is attached.
Mounted actions
$mountedActions
array<Filament\Actions\Action>
The array of actions that are currently mounted in the Livewire component. This is useful for accessing data from parent actions.
Eloquent record
$record
?Illuminate\Database\Eloquent\Model
The Eloquent record for the current action, if one is attached.
Schema
$schema
Filament\Schemas\Schema
[Actions in schemas only] The schema object that this action belongs to.
Schema component
$schemaComponent
Filament\Schemas\Components\Component
[Actions in schemas only] The schema component that this action belongs to.
Schema component state
$schemaComponentState
mixed
[Actions in schemas only] The current value of the schema component.
Schema get function
$schemaGet
Filament\Schemas\Components\Utilities\Get
[Actions in schemas only] A function for retrieving values from the schema data. Validation is not run on form fields.
Schema operation
$schemaOperation
string
[Actions in schemas only] The current operation being performed by the schema. Usually
create, edit, or view.Schema set function
$schemaSet
Filament\Schemas\Components\Utilities\Set
[Actions in schemas only] A function for setting values in the schema data.
Schema state
$schemaState
mixed
[Actions in schemas only] The current value of the schema that this action belongs to, like the current repeater item.
Selected Eloquent records
$selectedRecords
Illuminate\Support\Collection
[Bulk actions only] The Eloquent records selected in the table.
Table
$table
Filament\Tables\Table
[Actions in tables only] The table object that this action belongs to.
Authorization
You may conditionally show or hide actions for certain users. To do this, you can use either thevisible() or hidden() methods:
As well as allowing static values, the visible() and hidden() methods also accept functions to dynamically calculate them. You can inject various utilities into the functions as parameters.
visible() and hidden() methods also accept functions to dynamically calculate them. You can inject various utilities into the functions as parameters.Learn more about utility injection.
Action
$action
Filament\Actions\Action
The current action instance.
Arguments
$arguments
array<string, mixed>
The array of arguments passed to the action when it was triggered.
Data
$data
array<string, mixed>
The array of data submitted from form fields in the action's modal. It will be empty before the modal form is submitted.
Livewire
$livewire
Livewire\Component
The Livewire component instance.
Eloquent model FQN
$model
?string<Illuminate\Database\Eloquent\Model>
The Eloquent model FQN for the current action, if one is attached.
Mounted actions
$mountedActions
array<Filament\Actions\Action>
The array of actions that are currently mounted in the Livewire component. This is useful for accessing data from parent actions.
Eloquent record
$record
?Illuminate\Database\Eloquent\Model
The Eloquent record for the current action, if one is attached.
Schema
$schema
Filament\Schemas\Schema
[Actions in schemas only] The schema object that this action belongs to.
Schema component
$schemaComponent
Filament\Schemas\Components\Component
[Actions in schemas only] The schema component that this action belongs to.
Schema component state
$schemaComponentState
mixed
[Actions in schemas only] The current value of the schema component.
Schema get function
$schemaGet
Filament\Schemas\Components\Utilities\Get
[Actions in schemas only] A function for retrieving values from the schema data. Validation is not run on form fields.
Schema operation
$schemaOperation
string
[Actions in schemas only] The current operation being performed by the schema. Usually
create, edit, or view.Schema set function
$schemaSet
Filament\Schemas\Components\Utilities\Set
[Actions in schemas only] A function for setting values in the schema data.
Schema state
$schemaState
mixed
[Actions in schemas only] The current value of the schema that this action belongs to, like the current repeater item.
Selected Eloquent records
$selectedRecords
Illuminate\Support\Collection
[Bulk actions only] The Eloquent records selected in the table.
Table
$table
Filament\Tables\Table
[Actions in tables only] The table object that this action belongs to.
Authorization using a policy
You can use a policy to authorize an action. To do this, pass the name of the policy method to theauthorize() method, and Filament will use the current Eloquent model for that action to find the correct policy:
If you’re using an action in a panel resource or relation manager, you don’t need to use the
authorize() method, since Filament will automatically read the policy based on the resource model for the built-in actions like CreateAction, EditAction and DeleteAction. For more information, visit the resource authorization section.authorizationTooltip() method:
authorizationNotification() method:
Disabling a button
If you want to disable a button instead of hiding it, you can use thedisabled() method:
As well as allowing a static value, the disabled() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.
disabled() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.Learn more about utility injection.
Action
$action
Filament\Actions\Action
The current action instance.
Arguments
$arguments
array<string, mixed>
The array of arguments passed to the action when it was triggered.
Data
$data
array<string, mixed>
The array of data submitted from form fields in the action's modal. It will be empty before the modal form is submitted.
Livewire
$livewire
Livewire\Component
The Livewire component instance.
Eloquent model FQN
$model
?string<Illuminate\Database\Eloquent\Model>
The Eloquent model FQN for the current action, if one is attached.
Mounted actions
$mountedActions
array<Filament\Actions\Action>
The array of actions that are currently mounted in the Livewire component. This is useful for accessing data from parent actions.
Eloquent record
$record
?Illuminate\Database\Eloquent\Model
The Eloquent record for the current action, if one is attached.
Schema
$schema
Filament\Schemas\Schema
[Actions in schemas only] The schema object that this action belongs to.
Schema component
$schemaComponent
Filament\Schemas\Components\Component
[Actions in schemas only] The schema component that this action belongs to.
Schema component state
$schemaComponentState
mixed
[Actions in schemas only] The current value of the schema component.
Schema get function
$schemaGet
Filament\Schemas\Components\Utilities\Get
[Actions in schemas only] A function for retrieving values from the schema data. Validation is not run on form fields.
Schema operation
$schemaOperation
string
[Actions in schemas only] The current operation being performed by the schema. Usually
create, edit, or view.Schema set function
$schemaSet
Filament\Schemas\Components\Utilities\Set
[Actions in schemas only] A function for setting values in the schema data.
Schema state
$schemaState
mixed
[Actions in schemas only] The current value of the schema that this action belongs to, like the current repeater item.
Selected Eloquent records
$selectedRecords
Illuminate\Support\Collection
[Bulk actions only] The Eloquent records selected in the table.
Table
$table
Filament\Tables\Table
[Actions in tables only] The table object that this action belongs to.
Registering keybindings
You can attach keyboard shortcuts to trigger buttons. These use the same key codes as Mousetrap:As well as allowing a static value, the keyBindings() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.
keyBindings() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.Learn more about utility injection.
Action
$action
Filament\Actions\Action
The current action instance.
Arguments
$arguments
array<string, mixed>
The array of arguments passed to the action when it was triggered.
Data
$data
array<string, mixed>
The array of data submitted from form fields in the action's modal. It will be empty before the modal form is submitted.
Livewire
$livewire
Livewire\Component
The Livewire component instance.
Eloquent model FQN
$model
?string<Illuminate\Database\Eloquent\Model>
The Eloquent model FQN for the current action, if one is attached.
Mounted actions
$mountedActions
array<Filament\Actions\Action>
The array of actions that are currently mounted in the Livewire component. This is useful for accessing data from parent actions.
Eloquent record
$record
?Illuminate\Database\Eloquent\Model
The Eloquent record for the current action, if one is attached.
Schema
$schema
Filament\Schemas\Schema
[Actions in schemas only] The schema object that this action belongs to.
Schema component
$schemaComponent
Filament\Schemas\Components\Component
[Actions in schemas only] The schema component that this action belongs to.
Schema component state
$schemaComponentState
mixed
[Actions in schemas only] The current value of the schema component.
Schema get function
$schemaGet
Filament\Schemas\Components\Utilities\Get
[Actions in schemas only] A function for retrieving values from the schema data. Validation is not run on form fields.
Schema operation
$schemaOperation
string
[Actions in schemas only] The current operation being performed by the schema. Usually
create, edit, or view.Schema set function
$schemaSet
Filament\Schemas\Components\Utilities\Set
[Actions in schemas only] A function for setting values in the schema data.
Schema state
$schemaState
mixed
[Actions in schemas only] The current value of the schema that this action belongs to, like the current repeater item.
Selected Eloquent records
$selectedRecords
Illuminate\Support\Collection
[Bulk actions only] The Eloquent records selected in the table.
Table
$table
Filament\Tables\Table
[Actions in tables only] The table object that this action belongs to.
Adding a badge to the corner of the button
You can add a badge to the corner of the button, to display whatever you want. It’s useful for displaying a count of something, or a status indicator:As well as allowing a static value, the badge() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.
badge() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.Learn more about utility injection.
Action
$action
Filament\Actions\Action
The current action instance.
Arguments
$arguments
array<string, mixed>
The array of arguments passed to the action when it was triggered.
Data
$data
array<string, mixed>
The array of data submitted from form fields in the action's modal. It will be empty before the modal form is submitted.
Livewire
$livewire
Livewire\Component
The Livewire component instance.
Eloquent model FQN
$model
?string<Illuminate\Database\Eloquent\Model>
The Eloquent model FQN for the current action, if one is attached.
Mounted actions
$mountedActions
array<Filament\Actions\Action>
The array of actions that are currently mounted in the Livewire component. This is useful for accessing data from parent actions.
Eloquent record
$record
?Illuminate\Database\Eloquent\Model
The Eloquent record for the current action, if one is attached.
Schema
$schema
Filament\Schemas\Schema
[Actions in schemas only] The schema object that this action belongs to.
Schema component
$schemaComponent
Filament\Schemas\Components\Component
[Actions in schemas only] The schema component that this action belongs to.
Schema component state
$schemaComponentState
mixed
[Actions in schemas only] The current value of the schema component.
Schema get function
$schemaGet
Filament\Schemas\Components\Utilities\Get
[Actions in schemas only] A function for retrieving values from the schema data. Validation is not run on form fields.
Schema operation
$schemaOperation
string
[Actions in schemas only] The current operation being performed by the schema. Usually
create, edit, or view.Schema set function
$schemaSet
Filament\Schemas\Components\Utilities\Set
[Actions in schemas only] A function for setting values in the schema data.
Schema state
$schemaState
mixed
[Actions in schemas only] The current value of the schema that this action belongs to, like the current repeater item.
Selected Eloquent records
$selectedRecords
Illuminate\Support\Collection
[Bulk actions only] The Eloquent records selected in the table.
Table
$table
Filament\Tables\Table
[Actions in tables only] The table object that this action belongs to.
As well as allowing a static value, the badgeColor() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.
badgeColor() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.Learn more about utility injection.
Action
$action
Filament\Actions\Action
The current action instance.
Arguments
$arguments
array<string, mixed>
The array of arguments passed to the action when it was triggered.
Data
$data
array<string, mixed>
The array of data submitted from form fields in the action's modal. It will be empty before the modal form is submitted.
Livewire
$livewire
Livewire\Component
The Livewire component instance.
Eloquent model FQN
$model
?string<Illuminate\Database\Eloquent\Model>
The Eloquent model FQN for the current action, if one is attached.
Mounted actions
$mountedActions
array<Filament\Actions\Action>
The array of actions that are currently mounted in the Livewire component. This is useful for accessing data from parent actions.
Eloquent record
$record
?Illuminate\Database\Eloquent\Model
The Eloquent record for the current action, if one is attached.
Schema
$schema
Filament\Schemas\Schema
[Actions in schemas only] The schema object that this action belongs to.
Schema component
$schemaComponent
Filament\Schemas\Components\Component
[Actions in schemas only] The schema component that this action belongs to.
Schema component state
$schemaComponentState
mixed
[Actions in schemas only] The current value of the schema component.
Schema get function
$schemaGet
Filament\Schemas\Components\Utilities\Get
[Actions in schemas only] A function for retrieving values from the schema data. Validation is not run on form fields.
Schema operation
$schemaOperation
string
[Actions in schemas only] The current operation being performed by the schema. Usually
create, edit, or view.Schema set function
$schemaSet
Filament\Schemas\Components\Utilities\Set
[Actions in schemas only] A function for setting values in the schema data.
Schema state
$schemaState
mixed
[Actions in schemas only] The current value of the schema that this action belongs to, like the current repeater item.
Selected Eloquent records
$selectedRecords
Illuminate\Support\Collection
[Bulk actions only] The Eloquent records selected in the table.
Table
$table
Filament\Tables\Table
[Actions in tables only] The table object that this action belongs to.
Outlined button style
When you’re using the “button” trigger style, you might wish to make it less prominent. You could use a different color, but sometimes you might want to make it outlined instead. You can do this with theoutlined() method:
As well as allowing a static value, the outlined() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.
outlined() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.Learn more about utility injection.
Action
$action
Filament\Actions\Action
The current action instance.
Arguments
$arguments
array<string, mixed>
The array of arguments passed to the action when it was triggered.
Data
$data
array<string, mixed>
The array of data submitted from form fields in the action's modal. It will be empty before the modal form is submitted.
Livewire
$livewire
Livewire\Component
The Livewire component instance.
Eloquent model FQN
$model
?string<Illuminate\Database\Eloquent\Model>
The Eloquent model FQN for the current action, if one is attached.
Mounted actions
$mountedActions
array<Filament\Actions\Action>
The array of actions that are currently mounted in the Livewire component. This is useful for accessing data from parent actions.
Eloquent record
$record
?Illuminate\Database\Eloquent\Model
The Eloquent record for the current action, if one is attached.
Schema
$schema
Filament\Schemas\Schema
[Actions in schemas only] The schema object that this action belongs to.
Schema component
$schemaComponent
Filament\Schemas\Components\Component
[Actions in schemas only] The schema component that this action belongs to.
Schema component state
$schemaComponentState
mixed
[Actions in schemas only] The current value of the schema component.
Schema get function
$schemaGet
Filament\Schemas\Components\Utilities\Get
[Actions in schemas only] A function for retrieving values from the schema data. Validation is not run on form fields.
Schema operation
$schemaOperation
string
[Actions in schemas only] The current operation being performed by the schema. Usually
create, edit, or view.Schema set function
$schemaSet
Filament\Schemas\Components\Utilities\Set
[Actions in schemas only] A function for setting values in the schema data.
Schema state
$schemaState
mixed
[Actions in schemas only] The current value of the schema that this action belongs to, like the current repeater item.
Selected Eloquent records
$selectedRecords
Illuminate\Support\Collection
[Bulk actions only] The Eloquent records selected in the table.
Table
$table
Filament\Tables\Table
[Actions in tables only] The table object that this action belongs to.
Adding extra HTML attributes to an action
You can pass extra HTML attributes to the action via theextraAttributes() method, which will be merged onto its outer HTML element. The attributes should be represented by an array, where the key is the attribute name and the value is the attribute value:
As well as allowing a static value, the extraAttributes() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.
extraAttributes() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.Learn more about utility injection.
Action
$action
Filament\Actions\Action
The current action instance.
Arguments
$arguments
array<string, mixed>
The array of arguments passed to the action when it was triggered.
Data
$data
array<string, mixed>
The array of data submitted from form fields in the action's modal. It will be empty before the modal form is submitted.
Livewire
$livewire
Livewire\Component
The Livewire component instance.
Eloquent model FQN
$model
?string<Illuminate\Database\Eloquent\Model>
The Eloquent model FQN for the current action, if one is attached.
Mounted actions
$mountedActions
array<Filament\Actions\Action>
The array of actions that are currently mounted in the Livewire component. This is useful for accessing data from parent actions.
Eloquent record
$record
?Illuminate\Database\Eloquent\Model
The Eloquent record for the current action, if one is attached.
Schema
$schema
Filament\Schemas\Schema
[Actions in schemas only] The schema object that this action belongs to.
Schema component
$schemaComponent
Filament\Schemas\Components\Component
[Actions in schemas only] The schema component that this action belongs to.
Schema component state
$schemaComponentState
mixed
[Actions in schemas only] The current value of the schema component.
Schema get function
$schemaGet
Filament\Schemas\Components\Utilities\Get
[Actions in schemas only] A function for retrieving values from the schema data. Validation is not run on form fields.
Schema operation
$schemaOperation
string
[Actions in schemas only] The current operation being performed by the schema. Usually
create, edit, or view.Schema set function
$schemaSet
Filament\Schemas\Components\Utilities\Set
[Actions in schemas only] A function for setting values in the schema data.
Schema state
$schemaState
mixed
[Actions in schemas only] The current value of the schema that this action belongs to, like the current repeater item.
Selected Eloquent records
$selectedRecords
Illuminate\Support\Collection
[Bulk actions only] The Eloquent records selected in the table.
Table
$table
Filament\Tables\Table
[Actions in tables only] The table object that this action belongs to.
Rate limiting actions
You can rate limit actions by using therateLimit() method. This method accepts the number of attempts per minute that a user IP address can make. If the user exceeds this limit, the action will not run and a notification will be shown:
As well as allowing a static value, the rateLimit() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.
rateLimit() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.Learn more about utility injection.
Action
$action
Filament\Actions\Action
The current action instance.
Arguments
$arguments
array<string, mixed>
The array of arguments passed to the action when it was triggered.
Data
$data
array<string, mixed>
The array of data submitted from form fields in the action's modal. It will be empty before the modal form is submitted.
Livewire
$livewire
Livewire\Component
The Livewire component instance.
Eloquent model FQN
$model
?string<Illuminate\Database\Eloquent\Model>
The Eloquent model FQN for the current action, if one is attached.
Mounted actions
$mountedActions
array<Filament\Actions\Action>
The array of actions that are currently mounted in the Livewire component. This is useful for accessing data from parent actions.
Eloquent record
$record
?Illuminate\Database\Eloquent\Model
The Eloquent record for the current action, if one is attached.
Schema
$schema
Filament\Schemas\Schema
[Actions in schemas only] The schema object that this action belongs to.
Schema component
$schemaComponent
Filament\Schemas\Components\Component
[Actions in schemas only] The schema component that this action belongs to.
Schema component state
$schemaComponentState
mixed
[Actions in schemas only] The current value of the schema component.
Schema get function
$schemaGet
Filament\Schemas\Components\Utilities\Get
[Actions in schemas only] A function for retrieving values from the schema data. Validation is not run on form fields.
Schema operation
$schemaOperation
string
[Actions in schemas only] The current operation being performed by the schema. Usually
create, edit, or view.Schema set function
$schemaSet
Filament\Schemas\Components\Utilities\Set
[Actions in schemas only] A function for setting values in the schema data.
Schema state
$schemaState
mixed
[Actions in schemas only] The current value of the schema that this action belongs to, like the current repeater item.
Selected Eloquent records
$selectedRecords
Illuminate\Support\Collection
[Bulk actions only] The Eloquent records selected in the table.
Table
$table
Filament\Tables\Table
[Actions in tables only] The table object that this action belongs to.
Customizing the rate limited notification
When an action is rate limited, a notification is dispatched to the user, which indicates the rate limit. To customize the title of this notification, use therateLimitedNotificationTitle() method:
As well as allowing a static value, the rateLimitedNotificationTitle() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.
rateLimitedNotificationTitle() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.Learn more about utility injection.
Action
$action
Filament\Actions\Action
The current action instance.
Arguments
$arguments
array<string, mixed>
The array of arguments passed to the action when it was triggered.
Data
$data
array<string, mixed>
The array of data submitted from form fields in the action's modal. It will be empty before the modal form is submitted.
Livewire
$livewire
Livewire\Component
The Livewire component instance.
Eloquent model FQN
$model
?string<Illuminate\Database\Eloquent\Model>
The Eloquent model FQN for the current action, if one is attached.
Mounted actions
$mountedActions
array<Filament\Actions\Action>
The array of actions that are currently mounted in the Livewire component. This is useful for accessing data from parent actions.
Eloquent record
$record
?Illuminate\Database\Eloquent\Model
The Eloquent record for the current action, if one is attached.
Schema
$schema
Filament\Schemas\Schema
[Actions in schemas only] The schema object that this action belongs to.
Schema component
$schemaComponent
Filament\Schemas\Components\Component
[Actions in schemas only] The schema component that this action belongs to.
Schema component state
$schemaComponentState
mixed
[Actions in schemas only] The current value of the schema component.
Schema get function
$schemaGet
Filament\Schemas\Components\Utilities\Get
[Actions in schemas only] A function for retrieving values from the schema data. Validation is not run on form fields.
Schema operation
$schemaOperation
string
[Actions in schemas only] The current operation being performed by the schema. Usually
create, edit, or view.Schema set function
$schemaSet
Filament\Schemas\Components\Utilities\Set
[Actions in schemas only] A function for setting values in the schema data.
Schema state
$schemaState
mixed
[Actions in schemas only] The current value of the schema that this action belongs to, like the current repeater item.
Selected Eloquent records
$selectedRecords
Illuminate\Support\Collection
[Bulk actions only] The Eloquent records selected in the table.
Table
$table
Filament\Tables\Table
[Actions in tables only] The table object that this action belongs to.
rateLimitedNotification() method:
As well as allowing a static value, the rateLimitedNotification() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.
rateLimitedNotification() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.Learn more about utility injection.
Action
$action
Filament\Actions\Action
The current action instance.
Arguments
$arguments
array<string, mixed>
The array of arguments passed to the action when it was triggered.
Data
$data
array<string, mixed>
The array of data submitted from form fields in the action's modal. It will be empty before the modal form is submitted.
Exception
$exception
DanHarrin\LivewireRateLimiting\Exceptions\TooManyRequestsException
The exception encountered when the rate limit was hit.
Livewire
$livewire
Livewire\Component
The Livewire component instance.
Minutes until available
$minutes
int
The number of minutes until the rate limit will pass.
Eloquent model FQN
$model
?string<Illuminate\Database\Eloquent\Model>
The Eloquent model FQN for the current action, if one is attached.
Mounted actions
$mountedActions
array<Filament\Actions\Action>
The array of actions that are currently mounted in the Livewire component. This is useful for accessing data from parent actions.
Notification
$notification
Filament\Notifications\Notification
The default notification object for the rate limit, which could be a useful starting point for customization.
Eloquent record
$record
?Illuminate\Database\Eloquent\Model
The Eloquent record for the current action, if one is attached.
Schema
$schema
Filament\Schemas\Schema
[Actions in schemas only] The schema object that this action belongs to.
Schema component
$schemaComponent
Filament\Schemas\Components\Component
[Actions in schemas only] The schema component that this action belongs to.
Schema component state
$schemaComponentState
mixed
[Actions in schemas only] The current value of the schema component.
Schema get function
$schemaGet
Filament\Schemas\Components\Utilities\Get
[Actions in schemas only] A function for retrieving values from the schema data. Validation is not run on form fields.
Schema operation
$schemaOperation
string
[Actions in schemas only] The current operation being performed by the schema. Usually
create, edit, or view.Schema set function
$schemaSet
Filament\Schemas\Components\Utilities\Set
[Actions in schemas only] A function for setting values in the schema data.
Schema state
$schemaState
mixed
[Actions in schemas only] The current value of the schema that this action belongs to, like the current repeater item.
Seconds until available
$seconds
int
The number of seconds until the rate limit will pass.
Selected Eloquent records
$selectedRecords
Illuminate\Support\Collection
[Bulk actions only] The Eloquent records selected in the table.
Table
$table
Filament\Tables\Table
[Actions in tables only] The table object that this action belongs to.
Customizing the rate limit behavior
If you wish to customize the rate limit behavior, you can use Laravel’s rate limiting features and Filament’s flash notifications together in the action. If you want to rate limit immediately when an action modal is opened, you can do so in themountUsing() method:
action() method:
Using actions in schemas
Action objects can be inserted anywhere in a schema, such as in form field slots, section headers and footers, or alongside prime components. When an action is used in a schema, it has access to the schema’s state via utility injection - you can use$schemaGet and $schemaSet in closures to read and modify form field values.
Running JavaScript when an action is clicked
If you need a simple action that runs JavaScript directly in the browser without making a network request, you can use theactionJs() method. This is useful for simple interactions like updating form field values instantly:
$get() and $set() utilities, which allow you to read and modify the state of form fields in the schema.
As well as allowing a static value, the actionJs() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.
actionJs() method also accepts a function to dynamically calculate it. You can inject various utilities into the function as parameters.Learn more about utility injection.
Action
$action
Filament\Actions\Action
The current action instance.
Arguments
$arguments
array<string, mixed>
The array of arguments passed to the action when it was triggered.
Data
$data
array<string, mixed>
The array of data submitted from form fields in the action's modal. It will be empty before the modal form is submitted.
Livewire
$livewire
Livewire\Component
The Livewire component instance.
Eloquent model FQN
$model
?string<Illuminate\Database\Eloquent\Model>
The Eloquent model FQN for the current action, if one is attached.
Mounted actions
$mountedActions
array<Filament\Actions\Action>
The array of actions that are currently mounted in the Livewire component. This is useful for accessing data from parent actions.
Eloquent record
$record
?Illuminate\Database\Eloquent\Model
The Eloquent record for the current action, if one is attached.
Schema
$schema
Filament\Schemas\Schema
[Actions in schemas only] The schema object that this action belongs to.
Schema component
$schemaComponent
Filament\Schemas\Components\Component
[Actions in schemas only] The schema component that this action belongs to.
Schema component state
$schemaComponentState
mixed
[Actions in schemas only] The current value of the schema component.
Schema get function
$schemaGet
Filament\Schemas\Components\Utilities\Get
[Actions in schemas only] A function for retrieving values from the schema data. Validation is not run on form fields.
Schema operation
$schemaOperation
string
[Actions in schemas only] The current operation being performed by the schema. Usually
create, edit, or view.Schema set function
$schemaSet
Filament\Schemas\Components\Utilities\Set
[Actions in schemas only] A function for setting values in the schema data.
Schema state
$schemaState
mixed
[Actions in schemas only] The current value of the schema that this action belongs to, like the current repeater item.
Selected Eloquent records
$selectedRecords
Illuminate\Support\Collection
[Bulk actions only] The Eloquent records selected in the table.
Table
$table
Filament\Tables\Table
[Actions in tables only] The table object that this action belongs to.
Any JavaScript string passed to the
actionJs() method will be executed in the browser, so you should never add user input directly into the string, as it could lead to cross-site scripting (XSS) vulnerabilities. User input from $get() should never be evaluated as JavaScript code, but is safe to use as a string value.Action utility injection
The vast majority of methods used to configure actions accept functions as parameters instead of hardcoded values:Injecting the current modal form data
If you wish to access the current modal form data, define a$data parameter:
Injecting the Eloquent record
If your action is associated with an Eloquent record, for example if it is on a table row, you can inject the record using a$record parameter:
Injecting the current arguments
If you wish to access the current arguments that have been passed to the action, define an$arguments parameter:
Injecting utilities from a schema
You can access various additional utilities if your action is defined in a schema:$schema- The schema instance that the action belongs to.$schemaComponent- The schema component instance that the action belongs to.$schemaComponentState- The current value of the schema component.$schemaState- The current value of the schema that this action belongs to, like the current repeater item.$schemaGet- A function for retrieving values from the schema data. Validation is not run on form fields.$schemaSet- A function for setting values in the schema data.$schemaOperation- The current operation being performed by the schema. Usuallycreate,edit, orview.
Injecting the current Livewire component instance
If you wish to access the current Livewire component instance that the action belongs to, define a$livewire parameter:
Injecting the current action instance
If you wish to access the current action instance, define a$action parameter: