Level 1
if anyone is facing a similar problem:
$controller = $request->route()->parameters['controller'];
allows you to get url parameters as a workaround
1 like
in my routes i call some controller dynamically for ajax:
//procession all ajax requests
Route::any('ajax/{controller}/{function}', function($controller,$function) {
return App::call('App\Http\Controllers\' . str_replace('.','\',$controller) . '@' . $function);
});
i also use middleware to check for access permissions for each controller:
$currentAction = \Route::currentRouteAction();
it works perfect for statically stated routes, but for App:call it returns null. any suggestion on a workaround? is there a better way to get a name of the controller in the middleware?
Please or to participate in this conversation.