© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
4 replies
Rozay

mutateRecordDataUsing

Hello,

I am working on a system to manage who is on call at a particular time.

We have a rota per day, and I want the user to be able to replicate a rota, automatically increasing the day by 1. However, the mutateRecordDataUsing method doesn't seem to be applying my changes.

I am calling it from my resource table like so:

Tables\Actions\ReplicateAction::make()
->mutateRecordDataUsing(function (array $data): array {
    $data['rota_date'] = now()->addDays(1)->format('Y-m-d');
    $data['description'] = 'Rota for '.$data['rota_date']->format('d F Y');
    return $data;
})
Tables\Actions\ReplicateAction::make()
->mutateRecordDataUsing(function (array $data): array {
    $data['rota_date'] = now()->addDays(1)->format('Y-m-d');
    $data['description'] = 'Rota for '.$data['rota_date']->format('d F Y');
    return $data;
})


The rota is replicated but with the same date details as the last one. I have experience with PHP/Laravel but I'm new to Livewire and Filament. I am sure I am missing something extremely simple!

Any advice would be appreciated.
Solution
Hello, thanks for your reply. I changed direction on this so the rotas are handled differently now, I did run into a similar issue with another one of my models and ended up using the before method on the replicate action:

->before(function (Grades $record) {
         $record->name = $record->name . ' (Copy)';
}),
->before(function (Grades $record) {
         $record->name = $record->name . ' (Copy)';
}),
Jump to solution
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

MutateRecordDataUsing
FilamentFFilament / ❓┊help
2y ago
mutateRecordDataUsing in Replicate Action not firing
FilamentFFilament / ❓┊help
8mo ago
EMERGENCY - before, using, and mutateRecordDataUsing doesn't work for EditAction
FilamentFFilament / ❓┊help
6mo ago
Copy the data of all fields to an new entry
FilamentFFilament / ❓┊help
3y ago