fix language setting only available in view (#1117)

This commit is contained in:
jatdung 2023-02-24 01:24:11 +08:00 committed by GitHub
parent cd4b522935
commit cefe07d218
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,6 +43,9 @@ class AppServiceProvider extends ServiceProvider
ProcessApps::dispatch(); ProcessApps::dispatch();
} }
$lang = Setting::fetch('language');
\App::setLocale($lang);
// User specific settings need to go here as session isn't available at this point in the app // User specific settings need to go here as session isn't available at this point in the app
view()->composer('*', function ($view) { view()->composer('*', function ($view) {
if (isset($_SERVER['HTTP_AUTHORIZATION']) && ! empty($_SERVER['HTTP_AUTHORIZATION'])) { if (isset($_SERVER['HTTP_AUTHORIZATION']) && ! empty($_SERVER['HTTP_AUTHORIZATION'])) {
@ -77,9 +80,6 @@ class AppServiceProvider extends ServiceProvider
$allusers = User::all(); $allusers = User::all();
$current_user = User::currentUser(); $current_user = User::currentUser();
$lang = Setting::fetch('language');
\App::setLocale($lang);
$view->with('alt_bg', $alt_bg); $view->with('alt_bg', $alt_bg);
$view->with('allusers', $allusers); $view->with('allusers', $allusers);
$view->with('current_user', $current_user); $view->with('current_user', $current_user);