diff --git a/src/Routing/RouteCollection.php b/src/Routing/RouteCollection.php index e5cd2931cbb..2db25d7a8e3 100644 --- a/src/Routing/RouteCollection.php +++ b/src/Routing/RouteCollection.php @@ -77,6 +77,12 @@ public function add(Route $route, array $options = []) // Explicit names if (isset($options['_name'])) { + if(isset($this->_named[$options['_name']])){ + throw new MissingRouteException([ + 'url' => $options['_name'], + 'message' => 'A named route was found for "%s" that used twice,Route names must be unique across your entire application.' + ]); + } $this->_named[$options['_name']] = $route; }