Skip to content

Commit

Permalink
improved finish update command
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed Apr 22, 2021
1 parent 110fe68 commit 5aec526
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions app/Console/Commands/FinishUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -48,16 +47,18 @@ public function handle()
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]);
Expand Down

0 comments on commit 5aec526

Please sign in to comment.