Reputation:
I could get the current url using {{ URL::current(); }}
in Laravel 4.2. But for some reason I need to get the current action, i.e. ControllerName@methodName
. Please note that I don't want to generate a url to a controller action. How can I get the current action?
Upvotes: 1
Views: 946
Reputation: 146269
You may use currentRouteAction()
method to get the current route action:
$action = Route::currentRouteAction();
Upvotes: 1
Reputation: 5874
Depends, if you are only trying to get the action name, I think you can use Route method.
Route::currentRouteAction();
You always have access to current Route by calling
$currentRoute = Route::current();
which will probably tell you everything you need to know.
More on Route: http://laravel.com/api/4.2/Illuminate/Routing/Router.html
Upvotes: 2