改名
This commit is contained in:
+18
-18
@@ -283,24 +283,7 @@ class Router extends Application implements RouterInterface
|
|||||||
$node->path = $value;
|
$node->path = $value;
|
||||||
$node->index = $index;
|
$node->index = $index;
|
||||||
$node->method = $method;
|
$node->method = $method;
|
||||||
|
$node->namespace = $this->loadNamespace($method);
|
||||||
$name = array_column($this->groupTacks, 'namespace');
|
|
||||||
|
|
||||||
$dir = array_column($this->groupTacks, 'dir');
|
|
||||||
if (!empty($dir)) {
|
|
||||||
array_unshift($name, implode('\\', $dir));
|
|
||||||
} else {
|
|
||||||
if ($method == 'package' || $method == 'receive') {
|
|
||||||
$dir = 'App\\Listener';
|
|
||||||
} else {
|
|
||||||
$dir = $this->dir;
|
|
||||||
}
|
|
||||||
array_unshift($name, $dir);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($name) && $name = array_filter($name)) {
|
|
||||||
$node->namespace = $name;
|
|
||||||
}
|
|
||||||
|
|
||||||
$name = array_column($this->groupTacks, 'middleware');
|
$name = array_column($this->groupTacks, 'middleware');
|
||||||
if ($this->middleware instanceof \Closure) {
|
if ($this->middleware instanceof \Closure) {
|
||||||
@@ -311,6 +294,23 @@ class Router extends Application implements RouterInterface
|
|||||||
return $node;
|
return $node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $method
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
private function loadNamespace($method)
|
||||||
|
{
|
||||||
|
$name = array_column($this->groupTacks, 'namespace');
|
||||||
|
if ($method == 'package' || $method == 'receive') {
|
||||||
|
$dir = 'App\\Listener';
|
||||||
|
} else {
|
||||||
|
$dir = $this->dir;
|
||||||
|
}
|
||||||
|
array_unshift($name, $dir);
|
||||||
|
return array_filter($name);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $config
|
* @param array $config
|
||||||
* @param callable $callback
|
* @param callable $callback
|
||||||
|
|||||||
Reference in New Issue
Block a user