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.
		
		
		
	
	
		
		
			
	
    
		
			
				
					
						                                                     | 
						 | 
						<?php
namespace App\AdminAgent\Forms;use App\Common\AgentType;use App\Common\UserStatus;use App\Models\Agent;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 = Agent::query()->find(Admin::user()->id);
        $model->name = $input['name'];        //$model->company_name = $input['company_name'];
        //$model->credit_codes = $input['credit_codes'];
        //$model->address = $input['address'];
        $model->director = $input['director'];        $model->contact_phone = $input['contact_phone'];        $model->contact_mobile = $input['contact_mobile'];//        $model->logo = $input['logo'];
        $model->avatar = $input['avatar'];        //$model->business_license = $input['business_license'];
        //$model->legal_persona_name = $input['legal_persona_name'];
        $model->legal_persona_wechat = $input['legal_persona_wechat'];//		$model->status = UserStatus::UNAUDITED;
		$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();    }
    /**     * Build a form here.     */    public function form()    {    	Admin::translation('agent');
		$this->display('type')->customFormat(fn() => AgentType::array()[$this->type] ?? '');
		$this->display('company_name')->required();		$this->display('province.name','省份');		$this->display('city.name','城市');		$this->display('area.name','地区');		$this->display('credit_codes')->required();		$this->display('address')->required();		$this->text('name')->required();		$this->text('director')->required();		$this->text('contact_phone')->required()->maxLength(15);		$this->text('contact_mobile')->required()->maxLength(11)->help('此号码将用于接收短信提醒(如订单提醒、付款提醒、核销提醒等)');		$this->image('license')->required()->disable();		$this->image('avatar');		$this->image('business_license')->required()->disable();		$this->text('legal_persona_name')->required()->disable();		$this->text('legal_persona_wechat')->required();
        $this->editor('agentInfo.about')->required();        $this->editor('agentInfo.reg_protocol')->required();        $this->editor('agentInfo.buy_protocol')->required();
//		$this->confirm('编辑确认', '编辑内容需要管理员重新审核,确定要提交吗?');
    }
    /**     * The data of the form.     *     * @return array     */    public function default()    {        return Agent::with(['agentInfo','province','city','area'])->find(Admin::user()->id)->toArray();    }}
  |