Print dd(\Route::currentRouteAction(), \Route::current());
The result is null, null
.
How to get the current controller (and method) information starting from laravel 5.2?
Remarks: When dingo is used, routing is taken over by dingo's DingoApiRoutingRouter
echo Route::getCurrentRoute()->getActionName();
输出
"AppHttpControllersApiUserController@index"
Use
dd(request()->route()->getAction());
dd(explode(__METHOD__));