| Total Complexity | 11 |
| Total Lines | 85 |
| Duplicated Lines | 0 % |
| Coverage | 28.13% |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 8 | class MassDeleteTool extends AbstractTool |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * Set CRUD object. |
||
| 12 | * |
||
| 13 | * @param CRUD $crud |
||
| 14 | */ |
||
| 15 | 1 | public function setCrud(CRUD $crud) |
|
| 16 | { |
||
| 17 | 1 | parent::setCrud($crud); |
|
| 18 | |||
| 19 | 1 | if ($this->check()) { |
|
| 20 | 1 | $this->crud()->enableBatchCheckboxes(true); |
|
| 21 | } |
||
| 22 | 1 | } |
|
| 23 | |||
| 24 | /** |
||
| 25 | * Position where should tool be placed. |
||
| 26 | */ |
||
| 27 | public function position() |
||
| 28 | { |
||
| 29 | return self::POSITION_BODY_TOP; |
||
| 30 | } |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Unique tool identifier. |
||
| 34 | */ |
||
| 35 | 1 | public function identifier(): string |
|
| 36 | { |
||
| 37 | 1 | return 'mass-delete'; |
|
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Tool's view. |
||
| 42 | */ |
||
| 43 | public function render() |
||
| 48 | ]); |
||
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * Handle tool execution. |
||
| 53 | * |
||
| 54 | * @param Request $request |
||
| 55 | * |
||
| 56 | * @return \Illuminate\Http\JsonResponse |
||
| 57 | */ |
||
| 58 | public function handle(Request $request) |
||
| 84 | ]); |
||
| 85 | } |
||
| 86 | |||
| 87 | /** |
||
| 88 | * Check allowance to show and process tool. |
||
| 89 | */ |
||
| 90 | 1 | public function check(): bool |
|
| 95 |