Custom action redirect
Hello, what would be the cleanest way to setup a redirect inside a custom action on Edit page. I'd like to redirect back to index page of my resource but this https://filamentphp.com/docs/2.x/admin/resources/editing-records#customizing-form-redirects does not for me with my custom action. Works fine with Save button but not my custom button
10 Replies
Custom action did you try a return redirect('path') ?
I did, but I was looking for a way to do it more "Filament-y" way
I don't believe there is for a form, since you handle it.
You can use the REsource::getURL('index'); to get the resouce url
That didn't work work me:
Route [filament.resources..index] not defined.
Not sure why since this is working just fine for me:
redirect()->route('filament.resources.events.index')
What did you try for the exact code? as [filament.resources..index] has an extra dot.
Yeah, I saw that too. Not sure where the double dot comes from
Resource ?!? You need to replace that with the resource Class.. So:
EventsResource::getUrl('index')
Ahhh, that's what I've missed. Sorry, started using Filament 4 days ago 😦
Works perfect now
No problem
and Thank you!