Opening URLs from notification actions thows error ==> Route [pagos.index] not defined.
Hello. I have an action in a notification which I want to take the user to a resource index page. The resource is called pagos. I have used the official documentation in:
https://filamentphp.com/docs/3.x/notifications/sending-notifications#opening-urls-from-notification-actions
and only changed route('posts.show') for route('pagos.index')
And it thows the same error. I have tried with 'admin.pagos.index', 'pagos', 'admin.pagos', tried in singular pago but I cannot achieve it.
Any ideas, please:
My code:
Solution:Jump to solution
I got a mistake and now I have solved it.
My Notification message with Action is included inside another Action.
I had this:
use Filament\Tables\Actions\Action;
Which is Ok for the main Action, but for the Action in the notification I must use:...
7 Replies
Hey,
By default Filament routes are named as
filament.admin.resources.{resourceName}.index
. If you have not customised it, try to change it to: filament.admin.resources.pagos.index
and see if that works for you.php artisan route::list
or ressource::getUrl('index')
might just be ressource::url('index')
pagos is not a word
its pages
Also, I dont recommend redirecting that way. This is better:
Solution
I got a mistake and now I have solved it.
My Notification message with Action is included inside another Action.
I had this:
use Filament\Tables\Actions\Action;
Which is Ok for the main Action, but for the Action in the notification I must use:
\Filament\Notifications\Actions\Action
So, now everything is working fine with this code:
Tks.
Thank you.
Pagos is PAYMENTS in Spanish and it is a resource.
ohhh 🤣
mb didnt know xd
Thank you everybody for your help.
We must be very careful using shortcuts like Action::make instead of \Filament\Notifications\Actions\Action or \Filament\Tables\Actions\Action. To be user it is better to use the whole route with \Filament...