request = $request; $this->account = $account; } /** * Execute the job. * * @return void */ public function handle() : ?Company { $company = new Company(); $company->name = isset($this->request['name']) ? $this->request['name'] : $this->request['first_name'] . ' ' . $this->request['last_name']; $company->account_id = $this->account->id; $company->company_key = $this->createHash(); $company->ip = request()->ip(); $company->settings = new CompanySettings(CompanySettings::defaults()); $company->db = config('database.default'); $company->save(); return $company; } }