RefreshButton.php 739 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace Dcat\Admin\Grid\Tools;
  3. use Illuminate\Contracts\Support\Renderable;
  4. class RefreshButton implements Renderable
  5. {
  6. protected $display = true;
  7. public function display($value)
  8. {
  9. $this->display = $value;
  10. return $this;
  11. }
  12. /**
  13. * Render refresh button of grid.
  14. *
  15. * @return string
  16. */
  17. public function render()
  18. {
  19. if (! $this->display) {
  20. return;
  21. }
  22. $refresh = trans('admin.refresh');
  23. return <<<EOT
  24. <button data-action="refresh" class="btn btn-primary grid-refresh btn-mini" style="margin-right:3px">
  25. <i class="feather icon-refresh-cw"></i><span class="d-none d-sm-inline">&nbsp; $refresh</span>
  26. </button>
  27. EOT;
  28. }
  29. }