If you ever need to get access to the current route within your application all you have to do is call the request class’
getAttribute method with an argument of
'route' and it will return the current route, which is an instance of the
From there you can get the route’s name by using
getName() or get the methods supported by this route via
Note: If you need to access the route from within your app middleware you must set
'determineRouteBeforeAppMiddleware' to true in your configuration otherwise
getAttribute('route') will return null. The route is always available in route middleware.