Skip to content

Commit ce0355c

Browse files
committed
trim prefix off
1 parent 9a7ab2d commit ce0355c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Illuminate/Routing/CompiledRouteCollection.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Illuminate\Container\Container;
66
use Illuminate\Http\Request;
77
use Illuminate\Support\Collection;
8+
use Illuminate\Support\Str;
89
use Symfony\Component\Routing\Matcher\CompiledUrlMatcher;
910
use Symfony\Component\Routing\RequestContext;
1011

@@ -221,7 +222,9 @@ public function mapAttributesToRoutes()
221222
*/
222223
protected function newRoute(array $attributes)
223224
{
224-
return (new Route($attributes['methods'], $attributes['uri'], $attributes['action']))
225+
$baseUri = ltrim(Str::replaceFirst(ltrim($attributes['action']['prefix'] ?? '', '/'), '', $attributes['uri']), '/');
226+
227+
return (new Route($attributes['methods'], $baseUri, $attributes['action']))
225228
->setFallback($attributes['fallback'])
226229
->setDefaults($attributes['defaults'])
227230
->setWheres($attributes['wheres'])

0 commit comments

Comments
 (0)