F
Filament15mo 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 Koch15mo ago
->afterCreate() hook? 🤔
ded7978
ded7978OP15mo ago
but where excaly i should use this hook
Dennis Koch
Dennis Koch15mo ago
On the Action
ded7978
ded7978OP15mo 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
ded7978OP15mo ago
i did like that. I fell like i did it wrong
No description
ded7978
ded7978OP15mo ago
it doesnt changing data idk why
Darpan
Darpan15mo ago
protected function mutateFormDataBeforeCreate(array $data): array
{
$data['title'] = 'mama';
return $data;
}
protected function mutateFormDataBeforeCreate(array $data): array
{
$data['title'] = 'mama';
return $data;
}
ded7978
ded7978OP15mo ago
thank u so much. i love u
Want results from more Discord servers?
Add your server