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

69 lines
1.8 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->avatar = $input['avatar'];
  26. $model->logo = $input['logo'];
  27. //$model->business_license = $input['business_license'];
  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->display('company_name');
  39. $this->display('province.name','省份');
  40. $this->display('city.name','城市');
  41. $this->display('area.name','地区');
  42. $this->display('address');
  43. $this->text('name')->required();
  44. $this->text('director')->required();
  45. $this->text('contact_phone')->required();
  46. $this->image('avatar');
  47. $this->image('logo')->required();
  48. $this->image('business_license')->required()->disable();
  49. $this->confirm('编辑确认', '编辑内容需要管理员重新审核,确定要提交吗?');
  50. }
  51. /**
  52. * The data of the form.
  53. *
  54. * @return array
  55. */
  56. public function default()
  57. {
  58. return Supplier::with(['province','city','area'])->find(Admin::user()->id)->toArray();
  59. }
  60. }