AceLeft.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. namespace App\Admin\Forms;
  3. use App\Admin\Renderable\DistDistributorTable;
  4. use App\Models\DistAdminDistributor;
  5. use Symfony\Component\HttpFoundation\Response;
  6. use Dcat\Admin\Widgets\Form;
  7. use App\Admin\Repositories\DistAppearance;
  8. class AceLeft extends Form
  9. {
  10. public function form()
  11. {
  12. //主题选择
  13. $this->select('appearance_id','Select Appearance')
  14. ->options(DistAppearance::selectOptions())
  15. ->width(12,12)
  16. ->setLabelClass('d-flex');
  17. //供应商选择
  18. $baseDistId = config('dictionary.base_dist_id');
  19. $this->selectTable('dist_id', 'Select Distributor')
  20. ->width(12,12)
  21. ->setLabelClass('d-flex')
  22. ->title('Select Distributor')
  23. ->placeholder('Select Distributor')
  24. ->from(DistDistributorTable::make())
  25. ->model(DistAdminDistributor::class, 'id', 'company_name')
  26. ->default($baseDistId);
  27. $this->disableSubmitButton();
  28. $this->disableResetButton();
  29. }
  30. // 处理表单提交请求
  31. public function handle(array $input)
  32. {
  33. return $this->response()->success('Processed successfully.')->refresh();
  34. }
  35. /**
  36. * 返回表单数据,如不需要可以删除此方法
  37. *
  38. * @return array
  39. */
  40. public function default()
  41. {
  42. return [
  43. ];
  44. }
  45. }