海南旅游SAAS
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

  1. <?php
  2. namespace App\AdminSupplier\Forms;
  3. use App\Common\UserStatus;
  4. use App\Models\Supplier;
  5. use Dcat\Admin\Admin;
  6. use Dcat\Admin\Widgets\Form;
  7. class SupplierInfo extends Form
  8. {
  9. /**
  10. * Handle the form request.
  11. *
  12. * @param array $input
  13. *
  14. * @return mixed
  15. */
  16. public function handle(array $input)
  17. {
  18. // dump($input);
  19. $model = Supplier::find(Admin::user()->id);
  20. $model->name = $input['name'];
  21. $model->company_name = $input['company_name'];
  22. $model->address = $input['address'];
  23. $model->director = $input['director'];
  24. $model->contact_phone = $input['contact_phone'];
  25. $model->avatar = $input['avatar'];
  26. $model->logo = $input['logo'];
  27. $model->license_pic = $input['license_pic'];
  28. $model->status = UserStatus::UNAUDITED;
  29. $model->save();
  30. return $this->response()->success('保存成功')->refresh();
  31. }
  32. /**
  33. * Build a form here.
  34. */
  35. public function form()
  36. {
  37. Admin::translation('supplier');
  38. $this->text('name')->required();
  39. $this->text('company_name')->required();
  40. $this->text('address')->required();
  41. $this->text('director')->required();
  42. $this->text('contact_phone')->required();
  43. $this->image('avatar');
  44. $this->image('logo')->required();
  45. $this->image('license_pic')->required();
  46. $this->confirm('编辑确认', '编辑内容需要管理员重新审核,确定要提交吗?');
  47. }
  48. /**
  49. * The data of the form.
  50. *
  51. * @return array
  52. */
  53. public function default()
  54. {
  55. return Supplier::find(Admin::user()->id)->toArray();
  56. }
  57. }