on-internet
← Community

Implicit model binding fails when using {locale} prefix in routes

Stack Overflow ·

I'm working on a multilingual Laravel 12 app. All my routes are grouped under a {locale} prefix, like this: Route::prefix('{locale}') ->group(function () { Route::get('/activities/{activity}', [ActivityController::class, 'show']) ->name('activities.show'); }); In my Localization middleware, I set the locale and define URL defaults: <?php namespace App\Http\Middleware; use Closure; use Illuminate\Http\Request; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\URL; use Symfony\Component\HttpFoundation\Response; /** * Middleware to set the application's locale based on URL parame

Comments

Sign in or sign up to comment and upvote.

No comments yet.