| Total Complexity | 6 |
| Total Lines | 61 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | class Single extends Component |
||
| 10 | { |
||
| 11 | |||
| 12 | public $crud; |
||
| 13 | |||
| 14 | public function mount(CRUD $crud) |
||
| 15 | { |
||
| 16 | $this->crud = $crud; |
||
| 17 | } |
||
| 18 | |||
| 19 | public function delete() |
||
| 20 | { |
||
| 21 | Artisan::call('panel:delete', [ |
||
| 22 | 'name' => $this->crud->name, |
||
| 23 | '--force' => true, |
||
| 24 | ]); |
||
| 25 | |||
| 26 | $this->crud->delete(); |
||
| 27 | $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('DeletedMessage', ['name' => __('CRUD') ] )]); |
||
| 28 | $this->emit('crudUpdated'); |
||
| 29 | } |
||
| 30 | |||
| 31 | public function build() |
||
| 44 | } |
||
| 45 | |||
| 46 | public function inactive() |
||
| 47 | { |
||
| 48 | $this->crud->update([ |
||
| 49 | 'active' => false |
||
| 50 | ]); |
||
| 51 | |||
| 52 | $this->dispatchBrowserEvent('show-message', ['type' => 'success', 'message' => __('CRUD was inactivated') ] ); |
||
| 53 | $this->emit('crudUpdated'); |
||
| 54 | } |
||
| 55 | |||
| 56 | public function active() |
||
| 64 | } |
||
| 65 | |||
| 66 | public function render() |
||
| 72 |