Code refactoring.

This commit is contained in:
EnesSacid-Buker 2022-06-03 17:51:22 +03:00 committed by GitHub
parent 649ab36be0
commit 0f637ebda7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -59,10 +59,12 @@ abstract class Factory extends BaseFactory
public function setCompany(): void public function setCompany(): void
{ {
if (is_null(Cache::get('factory_company_id'))) { $id = Cache::get('factory_company_id');
$this->company = $this->user->companies()->first();
if (! is_null($id)) {
$this->company = company($id);
} else { } else {
$this->company = company(Cache::get('factory_company_id')); $this->company = $this->user->companies()->first();
} }
$this->company->makeCurrent(); $this->company->makeCurrent();