F
Filament11mo ago
ded7978

Action after "Create"

We have button Create in the form. And i wanna do some action after create. How i can do that.
9 Replies
Dennis Koch
Dennis Koch11mo ago
->afterCreate() hook? 🤔
ded7978
ded797811mo ago
but where excaly i should use this hook
Dennis Koch
Dennis Koch11mo ago
On the Action
ded7978
ded797811mo ago
thx class CreateSending extends CreateRecord { protected static string $resource = SendingResource::class; protected function getCreateFormAction(): \Filament\Actions\Action { return parent::getCreateFormAction()->mutateFormDataUsing(function (array $data): array { $data['title'] = 'mama'; return $data; }); }
ded7978
ded797811mo ago
i did like that. I fell like i did it wrong
No description
ded7978
ded797811mo ago
it doesnt changing data idk why
Darpan
Darpan11mo ago
protected function mutateFormDataBeforeCreate(array $data): array
{
$data['title'] = 'mama';
return $data;
}
protected function mutateFormDataBeforeCreate(array $data): array
{
$data['title'] = 'mama';
return $data;
}
ded7978
ded797811mo ago
thank u so much. i love u