| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php
- namespace Dcat\Admin\Grid\Tools;
- use Dcat\Admin\Grid;
- use Illuminate\Contracts\Support\Renderable;
- abstract class AbstractTool implements Renderable
- {
- /**
- * @var Grid
- */
- protected $grid;
- /**
- * @var bool
- */
- protected $disabled = false;
- /**
- * Toggle this button.
- *
- * @param bool $disable
- *
- * @return $this
- */
- public function disable(bool $disable = true)
- {
- $this->disabled = $disable;
- return $this;
- }
- /**
- * If the tool is allowed.
- */
- public function allowed()
- {
- return !$this->disabled;
- }
- /**
- * Set parent grid.
- *
- * @param Grid $grid
- *
- * @return $this
- */
- public function setGrid(Grid $grid)
- {
- $this->grid = $grid;
- return $this;
- }
- /**
- * {@inheritdoc}
- */
- abstract public function render();
- /**
- * @return string
- */
- public function __toString()
- {
- return $this->render();
- }
- }
|