2

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()

2 Answers 2

3

In case you only want get bar from your current Route, you should use:

$method = explode('@', Route::currentRouteAction());
$method = end ($method);
Sign up to request clarification or add additional context in comments.

Comments

1

Try one of these:

Route::getCurrentRoute()->getAction();
Route::currentRouteAction();
Route::currentRouteName();

http://forumsarchive.laravel.io/viewtopic.php?id=10095

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.