add locale middleware
This commit is contained in:
parent
c5295f0fee
commit
4cb505276f
@ -22,18 +22,14 @@ class LocaleMiddleware
|
||||
$userSetting = UserSetting::where('user_id', auth()->user()->id)->first();
|
||||
|
||||
$locale = 'en';
|
||||
if (!empty($userSetting)) {
|
||||
if (!in_array($userSetting->language, ['en', 'ru', 'est'])) {
|
||||
$locale = $userSetting->language;
|
||||
}
|
||||
Session::put('locale', $locale);
|
||||
|
||||
app()->setLocale($locale);
|
||||
|
||||
if (!empty($userSetting)) {
|
||||
$userSetting->update([
|
||||
'language' => $locale
|
||||
]);
|
||||
}
|
||||
|
||||
Session::put('locale', $locale);
|
||||
app()->setLocale($locale);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
Loading…
Reference in New Issue
Block a user