diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 2173a97..47fa9de 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -63,5 +63,6 @@ class Kernel extends HttpKernel 'signed' => \App\Http\Middleware\ValidateSignature::class, 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequestsWithRedis::class, 'verified' => \App\Http\Middleware\EnsureUserIsVerified::class, + 'user.locale' => \App\Http\Middleware\UserLocale::class, ]; } diff --git a/app/Http/Middleware/UserLocale.php b/app/Http/Middleware/UserLocale.php new file mode 100644 index 0000000..89d7f47 --- /dev/null +++ b/app/Http/Middleware/UserLocale.php @@ -0,0 +1,19 @@ +user() && $request->user()->lang) { + App::setLocale($request->user()->lang->getLocale()); + } + + return $next($request); + } +}