From 90a95bd40681677cc5ffe1ada8be5650a455f0c2 Mon Sep 17 00:00:00 2001 From: saeideng Date: Tue, 9 Aug 2016 13:18:38 +0430 Subject: [PATCH] Route names must be unique --- src/Routing/RouteCollection.php | 6 ++++++ 1 file changed, 6 insertions(+) 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; }