Setting.php 1005 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Module\System\AdminForms;
  3. use Dcat\Admin\Traits\LazyWidget;
  4. use Dcat\Admin\Widgets\Form;
  5. use Dcat\Admin\Contracts\LazyRenderable;
  6. class Setting extends Form implements LazyRenderable
  7. {
  8. use LazyWidget;
  9. // 处理表单提交请求
  10. public function handle(array $input)
  11. {
  12. // dump($input);
  13. // return $this->response()->error('Your error message.');
  14. return $this->response()->success('Processed successfully.')->refresh();
  15. }
  16. // 构建表单
  17. public function form()
  18. {
  19. // Since v1.6.5 弹出确认弹窗
  20. $this->confirm('您确定要提交表单吗', 'content');
  21. $this->text('name')->required();
  22. $this->email('email')->rules('email');
  23. }
  24. /**
  25. * 返回表单数据,如不需要可以删除此方法
  26. *
  27. * @return array
  28. */
  29. public function default()
  30. {
  31. return [
  32. 'name' => 'John Doe',
  33. 'email' => 'John.Doe@gmail.com',
  34. ];
  35. }
  36. }