F
Filament16mo 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 Koch16mo ago
->afterCreate() hook? 🤔
ded7978
ded7978OP16mo ago
but where excaly i should use this hook
Dennis Koch
Dennis Koch16mo ago
On the Action
ded7978
ded7978OP16mo 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
ded7978OP16mo ago
i did like that. I fell like i did it wrong
No description
ded7978
ded7978OP16mo ago
it doesnt changing data idk why
Darpan
Darpan16mo ago
protected function mutateFormDataBeforeCreate(array $data): array
{
$data['title'] = 'mama';
return $data;
}
protected function mutateFormDataBeforeCreate(array $data): array
{
$data['title'] = 'mama';
return $data;
}
ded7978
ded7978OP16mo ago
thank u so much. i love u

Did you find this page helpful?