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

74 lines
2.1 KiB

4 years ago
4 years ago
  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->contact_mobile = $input['contact_mobile'];
  26. $model->avatar = $input['avatar'];
  27. // $model->license = $input['license'];
  28. //$model->business_license = $input['business_license'];
  29. // $model->status = UserStatus::UNAUDITED;
  30. $model->save();
  31. return $this->response()->success('保存成功')->refresh();
  32. }
  33. /**
  34. * Build a form here.
  35. */
  36. public function form()
  37. {
  38. Admin::translation('supplier');
  39. $this->display('company_name');
  40. $this->display('province.name','省份');
  41. $this->display('city.name','城市');
  42. $this->display('area.name','地区');
  43. $this->display('address');
  44. $this->display('credit_codes');
  45. $this->display('corporate_account');
  46. $this->display('deposit_bank');
  47. $this->text('name')->required();
  48. $this->text('director')->required();
  49. $this->text('contact_phone')->required()->maxLength(15);
  50. $this->text('contact_mobile')->required()->maxLength(11)->help('此号码将用于接收短信提醒(如订单提醒、付款提醒、核销提醒等)');
  51. $this->image('avatar');
  52. $this->multipleImage('license')->required()->disable();
  53. $this->image('business_license')->required()->disable();
  54. // $this->confirm('编辑确认', '编辑内容需要管理员重新审核,确定要提交吗?');
  55. }
  56. /**
  57. * The data of the form.
  58. *
  59. * @return array
  60. */
  61. public function default()
  62. {
  63. return Supplier::with(['province','city','area'])->find(Admin::user()->id)->toArray();
  64. }
  65. }