route(); if ($route instanceof \Illuminate\Routing\Route) { $controller = $route->getControllerClass(); $method = $route->getActionMethod(); // Skip closure routes (no controller) and invokable/closure actions where the // "method" resolves to the class name itself. if (is_string($controller) && $controller !== '' && is_string($method) && $method !== $controller) { $this->enforcer->enforce($controller, $method, $request->all()); } } return $next($request); } }