-
-
Notifications
You must be signed in to change notification settings - Fork 513
Open
Description
In a fresh Laravel 11 application using LaravelLocalization, translatable routes work as expected with:
- Multiple parameters
- Route Model Binding (including getRouteKeyName overwrite)
- Regular route usage without customizations
- customizing the key for route in
routes.php
However, customizing the key for a translatable route causes the route to fail.
Example
<?php
// resources/lang/es/routes.php
return [
"about" => "acerca",
"article" => "articulo/{article}/{title}",
"sublvl" => "a/b/c",
"user" => "users/{user:slug}",
];
<?php
// routes/web.php
use Illuminate\Support\Facades\Route;
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['localize']], function()
{
Route::get(LaravelLocalization::transRoute('routes.user'), function (\App\Models\User $user) {
return $user;
});
});
Calling localhost/users/bernd
won't resolve, even if a user with slug bernd
is in db.
adrinro
Metadata
Metadata
Assignees
Labels
No labels