From 44edf993c700ece871e92c0b1df06aa37d45bfca Mon Sep 17 00:00:00 2001 From: denisdulici Date: Wed, 1 Jan 2020 00:53:47 +0300 Subject: [PATCH] fixed settings cache --- app/Jobs/Common/CreateCompany.php | 9 ++++----- app/Jobs/Common/UpdateCompany.php | 2 +- database/seeds/Accounts.php | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/Jobs/Common/CreateCompany.php b/app/Jobs/Common/CreateCompany.php index 696987a4f..ab417276b 100644 --- a/app/Jobs/Common/CreateCompany.php +++ b/app/Jobs/Common/CreateCompany.php @@ -29,11 +29,12 @@ class CreateCompany extends Job */ public function handle() { - // Clear settings - setting()->forgetAll(); - $this->company = Company::create($this->request->all()); + // Clear settings + setting()->setExtraColumns(['company_id' => $this->company->id]); + setting()->forgetAll(); + $this->callSeeds(); $this->updateSettings(); @@ -64,8 +65,6 @@ class CreateCompany extends Job protected function updateSettings() { - setting()->setExtraColumns(['company_id' => $this->company->id]); - if ($this->request->file('logo')) { $company_logo = $this->getMedia($this->request->file('logo'), 'settings', $this->company->id); diff --git a/app/Jobs/Common/UpdateCompany.php b/app/Jobs/Common/UpdateCompany.php index b1726d26a..b5fbe610b 100644 --- a/app/Jobs/Common/UpdateCompany.php +++ b/app/Jobs/Common/UpdateCompany.php @@ -40,10 +40,10 @@ class UpdateCompany extends Job $this->company->update($this->request->all()); // Clear current settings + setting()->setExtraColumns(['company_id' => $this->company->id]); setting()->forgetAll(); // Load settings based on the given company - setting()->setExtraColumns(['company_id' => $this->company->id]); setting()->load(true); if ($this->request->has('name')) { diff --git a/database/seeds/Accounts.php b/database/seeds/Accounts.php index a08fbbac6..2a882b74b 100644 --- a/database/seeds/Accounts.php +++ b/database/seeds/Accounts.php @@ -26,8 +26,8 @@ class Accounts extends Seeder { $company_id = $this->command->argument('company'); - setting()->forgetAll(); setting()->setExtraColumns(['company_id' => $company_id]); + setting()->forgetAll(); $rows = [ [