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.
74 lines
2.1 KiB
74 lines
2.1 KiB
<?php
|
|
|
|
namespace App\AdminSupplier\Forms;
|
|
|
|
use App\Common\UserStatus;
|
|
use App\Models\Supplier;
|
|
use Dcat\Admin\Admin;
|
|
use Dcat\Admin\Widgets\Form;
|
|
|
|
class SupplierInfo extends Form
|
|
{
|
|
/**
|
|
* Handle the form request.
|
|
*
|
|
* @param array $input
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function handle(array $input)
|
|
{
|
|
// dump($input);
|
|
|
|
$model = Supplier::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->contact_mobile = $input['contact_mobile'];
|
|
$model->avatar = $input['avatar'];
|
|
// $model->license = $input['license'];
|
|
//$model->business_license = $input['business_license'];
|
|
// $model->status = UserStatus::UNAUDITED;
|
|
$model->save();
|
|
|
|
return $this->response()->success('保存成功')->refresh();
|
|
}
|
|
|
|
/**
|
|
* Build a form here.
|
|
*/
|
|
public function form()
|
|
{
|
|
Admin::translation('supplier');
|
|
|
|
$this->display('company_name');
|
|
$this->display('province.name','省份');
|
|
$this->display('city.name','城市');
|
|
$this->display('area.name','地区');
|
|
$this->display('address');
|
|
$this->display('credit_codes');
|
|
$this->display('corporate_account');
|
|
$this->display('deposit_bank');
|
|
$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('avatar');
|
|
$this->multipleImage('license')->required()->disable();
|
|
$this->image('business_license')->required()->disable();
|
|
|
|
// $this->confirm('编辑确认', '编辑内容需要管理员重新审核,确定要提交吗?');
|
|
}
|
|
|
|
/**
|
|
* The data of the form.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function default()
|
|
{
|
|
return Supplier::with(['province','city','area'])->find(Admin::user()->id)->toArray();
|
|
}
|
|
}
|