CourseField.php 753 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace App\Admin\Actions\Course;
  3. use Dcat\Admin\Form\AbstractTool;
  4. use Dcat\Admin\Widgets\Modal;
  5. class CourseField extends AbstractTool
  6. {
  7. /**
  8. * @return string
  9. */
  10. protected $title = '添加场地';
  11. protected $model;
  12. public function __construct(string $model = null, $id = 0)
  13. {
  14. $this->model = $model;
  15. $this->title = '<a class="btn btn-sm btn-primary" style="color:#ffffff;margin-right:10px">'.$this->title.'</a>';
  16. $this->id = $id;
  17. }
  18. public function render()
  19. {
  20. $form = CourseFieldForm::make()->payload(['id' => $this->id]);
  21. return Modal::make()
  22. ->lg()
  23. ->title('')
  24. ->body($form)
  25. ->button($this->title);
  26. }
  27. }