company) { // if ($user->company->status == UserCompany::STATUS_INIT) { // throw new ClientException("已经提交过资料了"); // } else { $user->company->name = $params['name']; $user->company->tax_no = $params['tax_no']; $user->company->status = 1; $user->company->tel = Arr::get($params, "tel"); $user->company->department = Arr::get($params, "department"); $user->company->linkman = Arr::get($params, "linkman"); $user->company->address = Arr::get($params, "address"); $user->company->save(); // } return $user->company; } else { $company = new UserCompany(); $company->name = $params['name']; $company->user_id = $user->id; $company->tax_no = $params['tax_no']; $company->status = 1; $company->tel = Arr::get($params, "tel"); $company->department = Arr::get($params, "department"); $company->linkman = Arr::get($params, "linkman"); $company->address = Arr::get($params, "address"); $company->save(); return $company; } } }