| Total Complexity | 4 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class Single extends Component |
||
| 9 | { |
||
| 10 | |||
| 11 | public $admin; |
||
| 12 | |||
| 13 | public function mount($admin) |
||
| 16 | } |
||
| 17 | |||
| 18 | public function delete() |
||
| 19 | { |
||
| 20 | if (auth()->id() == $this->admin->id) { |
||
| 21 | $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('CannotDeleteMessage', ['name' => __('Admin')])]); |
||
| 22 | return; |
||
| 23 | } |
||
| 24 | |||
| 25 | $this->admin->roles()->sync([]); |
||
| 26 | |||
| 27 | UserProviderFacade::deleteAdmin($this->admin->id); |
||
| 28 | |||
| 29 | $this->dispatchBrowserEvent('show-message', ['type' => 'error', 'message' => __('DeletedMessage', ['name' => __('Admin') ] )]); |
||
| 30 | $this->emit('adminsUpdated'); |
||
| 31 | } |
||
| 32 | |||
| 33 | public function render() |
||
| 37 | } |
||
| 38 | } |
||
| 39 |