|
|
|
@ -0,0 +1,63 @@ |
|
|
|
<?php |
|
|
|
|
|
|
|
namespace App\AdminSupplier\Forms; |
|
|
|
|
|
|
|
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->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(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* The data of the form. |
|
|
|
* |
|
|
|
* @return array |
|
|
|
*/ |
|
|
|
public function default() |
|
|
|
{ |
|
|
|
return Supplier::find(Admin::user()->id)->toArray(); |
|
|
|
} |
|
|
|
} |