Button.php 792 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace UCore\DcatAdmin\Widgets;
  3. use Illuminate\Contracts\Support\Renderable;
  4. use Dcat\Admin\Widgets\Widget;
  5. class Button extends Widget implements Renderable
  6. {
  7. protected $display = true;
  8. public $title = '按钮';
  9. public function __construct($title = '按钮')
  10. {
  11. $this->title = $title;
  12. }
  13. public function display($value)
  14. {
  15. $this->display = $value;
  16. return $this;
  17. }
  18. /**
  19. * Render refresh button of grid.
  20. *
  21. * @return string
  22. */
  23. public function render()
  24. {
  25. if (!$this->display) {
  26. return;
  27. }
  28. return <<<EOT
  29. <button class="btn btn-primary btn-mini" style="margin-right:3px">
  30. <span class="d-none d-sm-inline"> {$this->title} </span>
  31. </button>
  32. EOT;
  33. }
  34. }