/** * Get the middlewares for the given controller instance and method. * * @param \Illuminate\Routing\Controller $controller * @param string $method * @return array */ protected function getControllerMiddlewareFromInstance($controller, $method) { $middleware = $this->router->getMiddleware(); $results = []; foreach ($controller->getMiddleware() as $name => $options) { if (!$this->methodExcludedByOptions($method, $options)) { $results[] = Arr::get($middleware, $name, $name); } } return $results; }
/** * Get the middleware for the controller instance. * * @param \Illuminate\Routing\Controller $instance * @param string $method * @return array */ protected function getMiddleware($instance, $method) { $results = new Collection(); foreach ($instance->getMiddleware() as $name => $options) { if (!$this->methodExcludedByOptions($method, $options)) { $results[] = $this->router->resolveMiddlewareClassName($name); } } return $results->flatten()->all(); }
/** * Get the middleware for the controller instance. * * @param \Illuminate\Routing\Controller $instance * @param string $method * @return array */ protected function getMiddleware($instance, $method) { $middleware = $this->router->getMiddleware(); $results = []; foreach ($instance->getMiddleware() as $name => $options) { if (!$this->methodExcludedByOptions($method, $options)) { $results[] = array_get($middleware, $name, $name); } } return $results; }