diff --git a/src/Illuminate/Routing/CompiledRouteCollection.php b/src/Illuminate/Routing/CompiledRouteCollection.php index 095d3a9b9fee..bb6d1e22d0f2 100644 --- a/src/Illuminate/Routing/CompiledRouteCollection.php +++ b/src/Illuminate/Routing/CompiledRouteCollection.php @@ -252,11 +252,7 @@ public function getRoutesByMethod() }) ->map(function (Collection $routes) { return $routes->mapWithKeys(function (Route $route) { - if ($domain = $route->getDomain()) { - return [$domain.'/'.$route->uri => $route]; - } - - return [$route->uri => $route]; + return [$route->getDomain().$route->uri => $route]; })->all(); }) ->all(); diff --git a/tests/Integration/Routing/CompiledRouteCollectionTest.php b/tests/Integration/Routing/CompiledRouteCollectionTest.php index 655be8dbe6aa..fcaa4dad5d4e 100644 --- a/tests/Integration/Routing/CompiledRouteCollectionTest.php +++ b/tests/Integration/Routing/CompiledRouteCollectionTest.php @@ -527,13 +527,13 @@ public function testRouteWithSamePathAndSameMethodButDiffDomainNameWithOptionsMe $this->assertEquals([ 'HEAD' => [ - 'foo.localhost/same/path' => $routes['foo_domain'], - 'bar.localhost/same/path' => $routes['bar_domain'], + 'foo.localhostsame/path' => $routes['foo_domain'], + 'bar.localhostsame/path' => $routes['bar_domain'], 'same/path' => $routes['no_domain'], ], 'GET' => [ - 'foo.localhost/same/path' => $routes['foo_domain'], - 'bar.localhost/same/path' => $routes['bar_domain'], + 'foo.localhostsame/path' => $routes['foo_domain'], + 'bar.localhostsame/path' => $routes['bar_domain'], 'same/path' => $routes['no_domain'], ], ], $this->collection()->getRoutesByMethod());