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

49 lines
1.0 KiB

  1. <?php
  2. namespace App\AdminAgent\Forms;
  3. use App\Models\AgentInfo as Model;
  4. use Dcat\Admin\Admin;
  5. use Dcat\Admin\Widgets\Form;
  6. class AgentInfo 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 = Model::query()->find(Admin::user()->id);
  19. $model->about = $input['about'];
  20. $model->reg_protocol = $input['reg_protocol'];
  21. $model->buy_protocol = $input['buy_protocol'];
  22. $model->save();
  23. return $this->response()->success('保存成功')->refresh();
  24. }
  25. /**
  26. * Build a form here.
  27. */
  28. public function form()
  29. {
  30. $this->editor('about')->required();
  31. $this->editor('reg_protocol')->required();
  32. $this->editor('buy_protocol')->required();
  33. }
  34. /**
  35. * The data of the form.
  36. *
  37. * @return array
  38. */
  39. public function default()
  40. {
  41. return Model::query()->find(Admin::user()->id)->toArray();
  42. }
  43. }