© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
11 replies
Eric

CreateRecord equivalency for EditRecord - mutateFormDataBeforeFill

In the
EditRecord
EditRecord
i use the mutateFormDataBeforeFill:
protected function mutateFormDataBeforeFill(array $data): array
{
    $data['test'] = 'ok';

    return $data;
}
protected function mutateFormDataBeforeFill(array $data): array
{
    $data['test'] = 'ok';

    return $data;
}

So how to do it in the
CreateRecord
CreateRecord
? I've tried to find a similar method, but im not lucky so far 🤔
I want to do the same, mutate
$data
$data
, so it contains 'test' with a value
Solution
So you want a field to be prefilled when you are on the CreatePage? If so you would use the
->default()
->default()
for the given field.

For example
TextInput::make('dummy')->default('foo')
TextInput::make('dummy')->default('foo')


Or what exactly is it that you are trying to achieve?
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

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

QR in Form Section [CreateRecord, EditRecord]
FilamentFFilament / ❓┊help
2y ago
mutateFormDataBeforeFill
FilamentFFilament / ❓┊help
3y ago
mutateFormDataBeforeFill alternative for infolist.
FilamentFFilament / ❓┊help
3y ago
mutateFormDataBeforeFill question.
FilamentFFilament / ❓┊help
3y ago