| 
						
						
						
					 | 
				
				 | 
				
					@ -1,7 +1,7 @@ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					<?php | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					namespace App\AdminAgent\Forms; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use App\Models\AgentInfo as Model; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use App\Models\Agent; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use Dcat\Admin\Admin; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					use Dcat\Admin\Widgets\Form; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -18,11 +18,22 @@ class AgentInfo extends Form | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        // dump($input);
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        $model = Model::query()->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(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} |