How to get Current Route name in Laravel

You may use the current, currentRouteName, and currentRouteAction methods on the Route facade to access information about the route handling the incoming request:

$route = Route::current();

You may use below function to get current route name.

$name = Route::currentRouteName();

If you need action name about which method of Controller is used for current route or in coming request then use below piece of code.

$action = Route::currentRouteAction();

References

https://laravel.com/docs/5.8/routing#accessing-the-current-route

https://laravel.com/api/5.8/Illuminate/Routing/Router.html

https://laravel.com/api/5.8/Illuminate/Routing/Route.html

Leave a Reply

Your email address will not be published. Required fields are marked *