Skip to content

Commit

Permalink
fix localized route
Browse files Browse the repository at this point in the history
remove double /{locale?}
  • Loading branch information
MoamenEltouny committed Mar 19, 2022
1 parent a3acfb3 commit 2036c68
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Classes/Localization.php
Expand Up @@ -401,7 +401,7 @@ public function route(string $key, $params = [])
if(!$route)
throw new RouteNotFoundException('[' . $key . '] Route has not found.');

if (substr($route->getPrefix(), 0, 9) != '{locale?}')
if (substr(ltrim($route->getPrefix(), '/'), 0, 9) != '{locale?}')
$route->prefix('/{locale?}');

return app('url')->toRoute($route, array_merge($params, ['locale' => $locale]), true);
Expand Down

0 comments on commit 2036c68

Please sign in to comment.