From 5aec5260d0764b933b139c326b1143dc4e17cda4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Thu, 22 Apr 2021 12:02:49 +0300 Subject: [PATCH] improved finish update command --- app/Console/Commands/FinishUpdate.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/app/Console/Commands/FinishUpdate.php b/app/Console/Commands/FinishUpdate.php index 15e6f6b4c..93dd42e33 100644 --- a/app/Console/Commands/FinishUpdate.php +++ b/app/Console/Commands/FinishUpdate.php @@ -3,7 +3,6 @@ namespace App\Console\Commands; use App\Events\Install\UpdateFinished; -use App\Models\Common\Company; use Illuminate\Console\Command; class FinishUpdate extends Command @@ -48,16 +47,18 @@ class FinishUpdate extends Command throw new \Exception(trans('modules.errors.finish', ['module' => $alias])); } - // Set locale for modules - if ($alias != 'core') { - $company = Company::find($company_id); + $company = company($company_id); - if (!empty($company->locale)) { - app()->setLocale($company->locale); - } + if (empty($company)) { + return; } - company($company_id)->makeCurrent(); + $company->makeCurrent(); + + // Set locale for modules + if (($alias != 'core') && !empty($company->locale)) { + app()->setLocale($company->locale); + } // Disable model cache during update config(['laravel-model-caching.enabled' => false]);