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

63 lines
1.4 KiB

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