improved tenant identification

This commit is contained in:
Denis Duliçi
2021-04-16 00:59:43 +03:00
parent 9635e6be5d
commit 2b07442260
126 changed files with 1719 additions and 999 deletions

View File

@ -31,14 +31,14 @@ class CreateCompany extends Job
*/
public function handle()
{
$current_company_id = company_id();
event(new CompanyCreating($this->request));
\DB::transaction(function () {
$this->company = Company::create($this->request->all());
// Clear settings
setting()->setExtraColumns(['company_id' => $this->company->id]);
setting()->forgetAll();
$this->company->makeCurrent();
$this->callSeeds();
@ -47,6 +47,10 @@ class CreateCompany extends Job
event(new CompanyCreated($this->company));
if (!empty($current_company_id)) {
company($current_company_id)->makeCurrent();
}
return $this->company;
}
@ -106,6 +110,5 @@ class CreateCompany extends Job
}
setting()->save();
setting()->forgetAll();
}
}