diff --git a/src/Routing/Router.php b/src/Routing/Router.php index d259d2cc5..ef8b0e8cc 100644 --- a/src/Routing/Router.php +++ b/src/Routing/Router.php @@ -251,7 +251,9 @@ protected function addApiRoute($route) $versions = array_get(last($this->groupStack), 'version', []); foreach ($versions as $version) { - $this->getApiRouteCollection($version)->add($route); + if ($collection = $this->getApiRouteCollection($version)) { + $collection->add($route); + } } return $route;