Skip to main content

Introduction

Filament includes an action that is able to replicate Eloquent records. You may use it like so:

Excluding attributes

The excludeAttributes() method is used to instruct the action which columns should be excluded from replication:

Customizing data before filling the form

You may wish to modify the data from a record before it is filled into the form. To do this, you may use the mutateRecordDataUsing() method to modify the $data array, and return the modified version before it is filled into the form:

Redirecting after replication

You may set up a custom redirect when the form is submitted using the successRedirectUrl() method:

Customizing the replicate notification

When the record is successfully replicated, 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 the replica is saved.

Halting the replication process

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