improved finish update command

This commit is contained in:
Denis Duliçi 2021-04-22 12:02:49 +03:00
parent 110fe689f7
commit 5aec5260d0

View File

@ -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)) {
if (empty($company)) {
return;
}
$company->makeCurrent();
// Set locale for modules
if (($alias != 'core') && !empty($company->locale)) {
app()->setLocale($company->locale);
}
}
company($company_id)->makeCurrent();
// Disable model cache during update
config(['laravel-model-caching.enabled' => false]);