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.
67 lines
1.6 KiB
67 lines
1.6 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->avatar = $input['avatar'];
|
|
$model->logo = $input['logo'];
|
|
$model->license_pic = $input['license_pic'];
|
|
$model->status = UserStatus::UNAUDITED;
|
|
$model->save();
|
|
|
|
return $this->response()->success('保存成功')->refresh();
|
|
}
|
|
|
|
/**
|
|
* Build a form here.
|
|
*/
|
|
public function form()
|
|
{
|
|
Admin::translation('supplier');
|
|
|
|
$this->text('name')->required();
|
|
$this->text('company_name')->required();
|
|
$this->text('address')->required();
|
|
$this->text('director')->required();
|
|
$this->text('contact_phone')->required();
|
|
$this->image('avatar');
|
|
$this->image('logo')->required();
|
|
$this->image('license_pic')->required();
|
|
|
|
$this->confirm('编辑确认', '编辑内容需要管理员重新审核,确定要提交吗?');
|
|
}
|
|
|
|
/**
|
|
* The data of the form.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function default()
|
|
{
|
|
return Supplier::find(Admin::user()->id)->toArray();
|
|
}
|
|
}
|