Skip to main content
You are currently viewing the documentation for Filament 3.x, which is a previous version of Filament.Looking for the current stable version? Visit the 5.x documentation.

Overview

Filament includes a prebuilt action that is able to create Eloquent records. When the trigger button is clicked, a modal will open with a form inside. The user fills the form, and that data is validated and saved into the database. You may use it like so:
If you want to add this action to the header of a table instead, you can use Filament\Tables\Actions\CreateAction:

Customizing data before saving

Sometimes, you may wish to modify form data before it is finally saved to the database. To do this, you may use the mutateFormDataUsing() method, which has access to the $data as an array, and returns the modified version:

Customizing the creation process

You can tweak how the record is created with the using() method:
$model is the class name of the model, but you can replace this with your own hard-coded class if you wish.

Redirecting after creation

You may set up a custom redirect when the form is submitted using the successRedirectUrl() method:
If you want to redirect using the created record, use the $record parameter:

Customizing the save notification

When the record is successfully created, a notification is dispatched to the user, which indicates the success of their action. To customize the title of this notification, use the successNotificationTitle() method:
You may customize the entire notification using the successNotification() method:
To disable the notification altogether, use the successNotification(null) method:

Lifecycle hooks

Hooks may be used to execute code at various points within the action’s lifecycle, like before a form is saved. There are several available hooks:

Halting the creation process

At any time, you may call $action->halt() from inside a lifecycle hook or mutation method, which will halt the entire creation process:
If you’d like the action modal to close too, you can completely cancel() the action instead of halting it:

Using a wizard

You may easily transform the creation process into a multistep wizard. Instead of using a form(), define a steps() array and pass your Step objects:
Now, create a new record to see your wizard in action! Edit will still use the form defined within the resource class. If you’d like to allow free navigation, so all the steps are skippable, use the skippableSteps() method:

Disabling create another

If you’d like to remove the “create another” button from the modal, you can use the createAnother(false) method: