F
Filament2mo ago
keiron

Redirect to List after Edit - Global setting?

Hi, the default behaviour after editing a resource is to stay on that resource's page. Is it possible to make a global change to redirect on edit to the List view?
Solution:
Starting with Filament v4, there is a global configuration option for this: ``` use Filament\Panel; ...
Jump to solution
6 Replies
keiron
keironOP2mo ago
This is a per view setting. I am looking for a global setting.
drabew
drabew2mo ago
You can create own abstract class EditRecord and put that code inside it. Next, just extend your edit views with created class, instead of class owned by Filament.
Solution
stefket
stefket2mo ago
Starting with Filament v4, there is a global configuration option for this:
use Filament\Panel;

public function panel(Panel $panel): Panel
{
return $panel
// ...
->resourceCreatePageRedirect('index') // or
->resourceCreatePageRedirect('view') // or
->resourceCreatePageRedirect('edit');
}
use Filament\Panel;

public function panel(Panel $panel): Panel
{
return $panel
// ...
->resourceCreatePageRedirect('index') // or
->resourceCreatePageRedirect('view') // or
->resourceCreatePageRedirect('edit');
}
https://filamentphp.com/docs/4.x/resources/creating-records#customizing-redirects
stefket
stefket2mo ago
use Filament\Panel;

public function panel(Panel $panel): Panel
{
return $panel
// ...
->resourceEditPageRedirect('index') // or
->resourceEditPageRedirect('view');
}
use Filament\Panel;

public function panel(Panel $panel): Panel
{
return $panel
// ...
->resourceEditPageRedirect('index') // or
->resourceEditPageRedirect('view');
}
https://filamentphp.com/docs/4.x/resources/editing-records
keiron
keironOP2mo ago
Lovely

Did you find this page helpful?