This commit is contained in:
2021-08-30 18:44:24 +08:00
parent 680480b9dc
commit b0120a2ed2
2 changed files with 26 additions and 6 deletions
+9 -3
View File
@@ -290,9 +290,6 @@ class Router extends HttpService implements RouterInterface
$node->namespace = $this->loadNamespace($method);
$name = array_column($this->groupTacks, 'middleware');
if ($this->middleware instanceof \Closure) {
$node->addMiddleware($method, [$this->middleware]);
}
if (is_array($name)) {
$node->addMiddleware($method, $this->resolve_middleware($name));
}
@@ -300,6 +297,15 @@ class Router extends HttpService implements RouterInterface
}
/**
* @return Closure
*/
public function getMiddleware(): Closure
{
return $this->middleware;
}
/**
* @param string|array $middleware
* @return array