diff --git a/app/AdminAgent/Forms/AgentInfo.php b/app/AdminAgent/Forms/AgentInfo.php index 342cfc9..023e166 100644 --- a/app/AdminAgent/Forms/AgentInfo.php +++ b/app/AdminAgent/Forms/AgentInfo.php @@ -1,7 +1,7 @@ find(Admin::user()->id); - $model->about = $input['about']; - $model->reg_protocol = $input['reg_protocol']; - $model->buy_protocol = $input['buy_protocol']; + $model = Agent::query()->find(Admin::user()->id); + + $model->name = $input['name']; + $model->company_name = $input['company_name']; + $model->address = $input['address']; + $model->director = $input['director']; + $model->contact_phone = $input['contact_phone']; + $model->logo = $input['logo']; + $model->avatar = $input['avatar']; + $model->license_pic = $input['license_pic']; + + $model->agentInfo->about = $input['agentInfo']['about']; + $model->agentInfo->reg_protocol = $input['agentInfo']['reg_protocol']; + $model->agentInfo->buy_protocol = $input['agentInfo']['buy_protocol']; $model->save(); + $model->agentInfo()->save($model->agentInfo); return $this->response()->success('保存成功')->refresh(); } @@ -32,9 +43,20 @@ class AgentInfo extends Form */ public function form() { - $this->editor('about')->required(); - $this->editor('reg_protocol')->required(); - $this->editor('buy_protocol')->required(); + Admin::translation('agent'); + + $this->text('name')->required(); + $this->text('company_name')->required(); + $this->text('address')->required(); + $this->text('director')->required(); + $this->text('contact_phone')->required(); + $this->image('logo')->required(); + $this->image('avatar'); + $this->image('license_pic')->required(); + + $this->editor('agentInfo.about')->required(); + $this->editor('agentInfo.reg_protocol')->required(); + $this->editor('agentInfo.buy_protocol')->required(); } /** @@ -44,6 +66,6 @@ class AgentInfo extends Form */ public function default() { - return Model::query()->find(Admin::user()->id)->toArray(); + return Agent::with('agentInfo')->find(Admin::user()->id)->toArray(); } } diff --git a/resources/lang/zh_CN/agent.php b/resources/lang/zh_CN/agent.php index 079ba7b..c7e3765 100644 --- a/resources/lang/zh_CN/agent.php +++ b/resources/lang/zh_CN/agent.php @@ -21,6 +21,7 @@ return [ 'license_pic' => '营业执照', 'director' => '负责人', 'contact_phone' => '联系电话', + 'agentInfo' => trans('agent-info.fields'), ], 'options' => [ ],