Skip to content

Commit

Permalink
trim prefix off
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Mar 3, 2020
1 parent 9a7ab2d commit ce0355c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Illuminate/Routing/CompiledRouteCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Container\Container;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;
use Symfony\Component\Routing\Matcher\CompiledUrlMatcher;
use Symfony\Component\Routing\RequestContext;

Expand Down Expand Up @@ -221,7 +222,9 @@ public function mapAttributesToRoutes()
*/
protected function newRoute(array $attributes)
{
return (new Route($attributes['methods'], $attributes['uri'], $attributes['action']))
$baseUri = ltrim(Str::replaceFirst(ltrim($attributes['action']['prefix'] ?? '', '/'), '', $attributes['uri']), '/');

return (new Route($attributes['methods'], $baseUri, $attributes['action']))
->setFallback($attributes['fallback'])
->setDefaults($attributes['defaults'])
->setWheres($attributes['wheres'])
Expand Down

0 comments on commit ce0355c

Please sign in to comment.