Reputation: 5135
if I have a simple route
Route::get('foo', 'path\to\controller\MyController@bar');
when I'm in my application - Is there a method/function that will return the controller method that was used? ie: bar
.... is there anything like \Route::getCurrentControllerMethod()
Upvotes: 2
Views: 1449
Reputation: 111829
In case you only want get bar
from your current Route, you should use:
$method = explode('@', Route::currentRouteAction());
$method = end ($method);
Upvotes: 3
Reputation: 7695
Try one of these:
Route::getCurrentRoute()->getAction();
Route::currentRouteAction();
Route::currentRouteName();
http://forumsarchive.laravel.io/viewtopic.php?id=10095
Upvotes: 1