© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•8mo ago•
4 replies
aldec

mutateRecordDataUsing in Replicate Action not firing

I try to replicate a record with the prebuilt replicate action and want to change a field with a unique constraint before it is saved via the mutateRecordDataUsing() method as is described in the documentation. But the methods is never called, no mutating, no logging from this method. I just get an SQL error
[2025-07-04 08:17:56] local.ERROR: SQLSTATE[23505]: Unique violation: 7 ERROR:  duplicate key value violates unique constraint "roles_name_guard_name_unique"
[2025-07-04 08:17:56] local.ERROR: SQLSTATE[23505]: Unique violation: 7 ERROR:  duplicate key value violates unique constraint "roles_name_guard_name_unique"


The complete getHeaderActions method looks like this:

public function getHeaderActions(): array
    {
        return [
            ViewAction::make(),
            DeleteAction::make(),
            ReplicateAction::make()
                ->excludeAttributes(['permissions_count'])
                ->mutateRecordDataUsing(function (array $data): array {
                    Log::error('WHYYYYY you not working');
                    $data['name'] = $data['name'] . '(Kopie)';
                    return $data;
                })
        ];
    }
public function getHeaderActions(): array
    {
        return [
            ViewAction::make(),
            DeleteAction::make(),
            ReplicateAction::make()
                ->excludeAttributes(['permissions_count'])
                ->mutateRecordDataUsing(function (array $data): array {
                    Log::error('WHYYYYY you not working');
                    $data['name'] = $data['name'] . '(Kopie)';
                    return $data;
                })
        ];
    }
Solution
does this help?

https://github.com/filamentphp/filament/issues/13604#issuecomment-2259131733
GitHub
`mutateRecordDataUsing` not mutating data when used with `Replicate...
Package filament/filament Package Version v3.2.40 Laravel Version v11.16.0 Livewire Version v3.5.4 PHP Version PHP 8.2 Problem description When using the mutateRecordDataUsing method with the Repli...
`mutateRecordDataUsing` not mutating data when used with `Replicate...
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

Replicate action
FilamentFFilament / ❓┊help
2y ago
Table rows Action->action() not firing
FilamentFFilament / ❓┊help
2y ago
MutateRecordDataUsing
FilamentFFilament / ❓┊help
2y ago
mutateRecordDataUsing
FilamentFFilament / ❓┊help
3y ago