You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							49 lines
						
					
					
						
							1.0 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							49 lines
						
					
					
						
							1.0 KiB
						
					
					
				
								<?php
							 | 
						|
								
							 | 
						|
								namespace App\AdminAgent\Forms;
							 | 
						|
								use App\Models\AgentInfo as Model;
							 | 
						|
								use Dcat\Admin\Admin;
							 | 
						|
								use Dcat\Admin\Widgets\Form;
							 | 
						|
								
							 | 
						|
								class AgentInfo extends Form
							 | 
						|
								{
							 | 
						|
								    /**
							 | 
						|
								     * Handle the form request.
							 | 
						|
								     *
							 | 
						|
								     * @param array $input
							 | 
						|
								     *
							 | 
						|
								     * @return mixed
							 | 
						|
								     */
							 | 
						|
								    public function handle(array $input)
							 | 
						|
								    {
							 | 
						|
								        // 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->save();
							 | 
						|
								
							 | 
						|
								        return $this->response()->success('保存成功')->refresh();
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * Build a form here.
							 | 
						|
								     */
							 | 
						|
								    public function form()
							 | 
						|
								    {
							 | 
						|
								        $this->editor('about')->required();
							 | 
						|
								        $this->editor('reg_protocol')->required();
							 | 
						|
								        $this->editor('buy_protocol')->required();
							 | 
						|
								    }
							 | 
						|
								
							 | 
						|
								    /**
							 | 
						|
								     * The data of the form.
							 | 
						|
								     *
							 | 
						|
								     * @return array
							 | 
						|
								     */
							 | 
						|
								    public function default()
							 | 
						|
								    {
							 | 
						|
								        return Model::query()->find(Admin::user()->id)->toArray();
							 | 
						|
								    }
							 | 
						|
								}
							 |