diff --git a/src/Router.php b/src/Router.php index 95e92fa..af8aa50 100644 --- a/src/Router.php +++ b/src/Router.php @@ -324,12 +324,20 @@ public function addRoute($method, $route, $action, $name = null, $definitions = //unset($methods[$i]); } } + if ($name === null) { + $this->rawRoutes[] = [ + 'route' => $this->baseUri.$route, + 'method' => $methods, + "definitions" => $definitions + ]; + } else { + $this->rawRoutes[$name] = [ + 'route' => $this->baseUri.$route, + 'method' => $methods, + "definitions" => $definitions + ]; + } - $this->rawRoutes[$name] = [ - 'route' => $this->baseUri.$route, - 'method' => $methods, - "definitions" => $definitions - ]; } /**