Route::currentRouteName() in Laravel 4.1
This blog post was originally published a little while ago. Please consider that it may no longer be relevant or even accurate.
Worth noting that Route::currentRouteName()
is no longer available in Laravel 4.1, likely a result of an Illuminate router replacing the Symfony router of the previous version. However, not all is lost! The new Illuminate router provides a lot of flexbility and while it might be a little more difficult to get the named route now there are a ton of new methods available to find out more about the route.
So, Route::current()
returns an instance of Illuminate\Routing\Route
(from the Illuminate\Routing\Router
/Route
facade). It is definitely worth having a look through the API of both these classes to see what helpers are available (like Route::currentRouteNamed()
to see if the current route is the one you specify) and to see what information you can access about the current route.