Custom Form Handling

Inside my custom form page, how can i redirect the user back after form submit and where to store the code to send a notification? I have followed the following docs https://filamentphp.com/docs/2.x/forms/getting-started#preparing-your-livewire-component but Im having a hard time handling what happens after form submit (redirect, send error notification...).
Filament
Getting started - Form Builder - Filament
The elegant TALL stack form builder for Laravel artisans.
1 Reply
Patrick Boivin
Patrick Boivin12mo ago
I think you can do all this from your submit() method... here's a quick example:
public function submit()
{
$validData = $this->validate();
// The method will stop here if there are any validation errors

try {
// Do something with $validData
} catch(...) {
Notification::make()
->title('An error has occurred...'))
->danger()
->send();

return;
}

return redirect()->to(...);
}
public function submit()
{
$validData = $this->validate();
// The method will stop here if there are any validation errors

try {
// Do something with $validData
} catch(...) {
Notification::make()
->title('An error has occurred...'))
->danger()
->send();

return;
}

return redirect()->to(...);
}