From c394f81c52378431b76f7c88a93e17b03c84951c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Tue, 7 Nov 2023 00:55:47 +0300 Subject: [PATCH] set default locale --- app/Http/Controllers/Modules/Item.php | 8 ++++---- app/Jobs/Install/DisableModule.php | 2 +- app/Jobs/Install/EnableModule.php | 2 +- app/Jobs/Install/InstallModule.php | 2 +- app/Jobs/Install/UninstallModule.php | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/Modules/Item.php b/app/Http/Controllers/Modules/Item.php index cc67ebeaa..0b08038f1 100644 --- a/app/Http/Controllers/Modules/Item.php +++ b/app/Http/Controllers/Modules/Item.php @@ -239,7 +239,7 @@ class Item extends Controller try { event(new \App\Events\Module\Installing($request['alias'], company_id())); - $this->dispatch(new InstallModule($request['alias'], company_id())); + $this->dispatch(new InstallModule($request['alias'], company_id(), setting('default.locale'))); $name = module($request['alias'])->getName(); $module_routes = module_attribute($request['alias'], 'routes', []); @@ -292,7 +292,7 @@ class Item extends Controller try { $name = module($alias)->getName(); - $this->dispatch(new UninstallModule($alias, company_id())); + $this->dispatch(new UninstallModule($alias, company_id(), setting('default.locale'))); $message = trans('modules.uninstalled', ['module' => $name]); @@ -311,7 +311,7 @@ class Item extends Controller try { $name = module($alias)->getName(); - $this->dispatch(new EnableModule($alias, company_id())); + $this->dispatch(new EnableModule($alias, company_id(), setting('default.locale'))); $message = trans('modules.enabled', ['module' => $name]); @@ -330,7 +330,7 @@ class Item extends Controller try { $name = module($alias)->getName(); - $this->dispatch(new DisableModule($alias, company_id())); + $this->dispatch(new DisableModule($alias, company_id(), setting('default.locale'))); $message = trans('modules.disabled', ['module' => $name]); diff --git a/app/Jobs/Install/DisableModule.php b/app/Jobs/Install/DisableModule.php index ab1d91b75..5afdc90d3 100644 --- a/app/Jobs/Install/DisableModule.php +++ b/app/Jobs/Install/DisableModule.php @@ -27,7 +27,7 @@ class DisableModule extends Job { $this->alias = $alias; $this->company_id = (int) $company_id; - $this->locale = $locale ?: company($company_id)->locale; + $this->locale = $locale ?: company($company_id)->locale ?: config('setting.fallback.default.locale'); } /** diff --git a/app/Jobs/Install/EnableModule.php b/app/Jobs/Install/EnableModule.php index d3fa288da..b7d24b9ed 100644 --- a/app/Jobs/Install/EnableModule.php +++ b/app/Jobs/Install/EnableModule.php @@ -27,7 +27,7 @@ class EnableModule extends Job { $this->alias = $alias; $this->company_id = (int) $company_id; - $this->locale = $locale ?: company($company_id)->locale; + $this->locale = $locale ?: company($company_id)->locale ?: config('setting.fallback.default.locale'); } /** diff --git a/app/Jobs/Install/InstallModule.php b/app/Jobs/Install/InstallModule.php index 70a74338b..2d0af6810 100644 --- a/app/Jobs/Install/InstallModule.php +++ b/app/Jobs/Install/InstallModule.php @@ -27,7 +27,7 @@ class InstallModule extends Job { $this->alias = $alias; $this->company_id = (int) $company_id; - $this->locale = $locale ?: company($company_id)->locale; + $this->locale = $locale ?: company($company_id)->locale ?: config('setting.fallback.default.locale'); } /** diff --git a/app/Jobs/Install/UninstallModule.php b/app/Jobs/Install/UninstallModule.php index dc2ba1358..6a5e14a04 100644 --- a/app/Jobs/Install/UninstallModule.php +++ b/app/Jobs/Install/UninstallModule.php @@ -27,7 +27,7 @@ class UninstallModule extends Job { $this->alias = $alias; $this->company_id = (int) $company_id; - $this->locale = $locale ?: company($company_id)->locale; + $this->locale = $locale ?: company($company_id)->locale ?: config('setting.fallback.default.locale'); } /**