Localization for Enum route binding #57185
Replies: 2 comments
-
You can use the custom route binding? https://laravel.com/docs/12.x/routing#customizing-the-resolution-logic |
Beta Was this translation helpful? Give feedback.
-
That was one of my first test and it kind of works because by doing so I'll get in my controller the right Enum. But when creating a link you can't write something like And I can't find a way on the Enum to 'tell' Laravel that the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Laravel as built-in Enum route binding https://laravel.com/docs/12.x/routing#implicit-enum-binding but from what I see in the code it take the
value
of the Backed Enum. In my case I have aslug()
method that return a translated value that I would like to use in the URL.Beta Was this translation helpful? Give feedback.
All reactions