Closed dirkam closed 4 months ago
It's the exact same route. The HTTP method doesn't matter. You can reference both with this name.
Thanks for the quick response @driesvints!
This is weird as it seems that Route::currentRouteName()
returns null
in the case of the POST
route.
I've just tested it with the login
route. When the login screen is shown (GET
), it returns login
. When the login is submitted the POST
route returns null
.
Am I doing something wrong?
Okay, I can see that's a problem for you. In this case currentRouteName
won't work.
Seeing https://github.com/laravel/fortify/pull/550 being declined I think it's highly unlikely we'll take any action here soon. You could try an attempt to submit a PR to add remaining route names but PR's in the past have been declined. If you do, please make sure to explicitly state the issue with the currentRouteName
method to build your case for it.
As of now, some routes don't have a name assigned.
But the POST route doesn't have a name:
This way one can only check for these routes in middlewares with
$request->getPathInfo()
and such, but it can be dynamic, for instance in the case of a multi-tenant application. With named routes, one can just checkRoute::currentRouteName()
or such.Or am I missing something to be able to still use route name checks for these routes?