CopyToAnotherChestAction.php 997 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace App\Module\GameItems\AdminControllers\Actions;
  3. use App\Module\GameItems\Models\Item;
  4. use Dcat\Admin\Form;
  5. use Dcat\Admin\Widgets\Modal;
  6. use UCore\DcatAdmin\Form\AbstractTool;
  7. class CopyToAnotherChestAction extends AbstractTool
  8. {
  9. protected $title = '复制消耗配置到其他宝箱';
  10. public function render()
  11. {
  12. $form = new Form();
  13. // 源宝箱选择
  14. $form->select('source_chest_id', '源宝箱')
  15. ->options(Item::where('type', 3)->pluck('name', 'id'))
  16. ->required();
  17. // 目标宝箱选择
  18. $form->select('target_chest_id', '目标宝箱')
  19. ->options(Item::where('type', 3)->pluck('name', 'id'))
  20. ->required();
  21. $form->action(admin_url('game-items/chest-open-costs/copy'));
  22. return Modal::make()
  23. ->lg()
  24. ->title($this->title)
  25. ->body($form)
  26. ->button("<button class='btn btn-primary'>{$this->title}</button>");
  27. }
  28. }