Delete.php 668 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace Dcat\Admin\Grid\Actions;
  3. use Dcat\Admin\Grid\RowAction;
  4. class Delete extends RowAction
  5. {
  6. /**
  7. * @return array|null|string
  8. */
  9. public function title()
  10. {
  11. return '<i class="feather icon-trash"></i> '.__('admin.delete');
  12. }
  13. public function render()
  14. {
  15. $this->setHtmlAttribute([
  16. 'data-url' => $this->url(),
  17. 'data-message' => "ID - {$this->getKey()}",
  18. 'data-action' => 'delete',
  19. ]);
  20. return parent::render(); // TODO: Change the autogenerated stub
  21. }
  22. public function url()
  23. {
  24. return "{$this->resource()}/{$this->getKey()}";
  25. }
  26. }