1 | <?php |
||
2 | |||
3 | namespace EasyPanel\Commands\UserActions; |
||
4 | |||
5 | use EasyPanel\Support\Contract\UserProviderFacade; |
||
6 | use Illuminate\Console\Command; |
||
7 | |||
8 | class DeleteAdmin extends Command |
||
9 | { |
||
10 | |||
11 | protected $signature = 'panel:remove {user} {--f|force}'; |
||
12 | protected $description = 'Remove an admin with user id'; |
||
13 | |||
14 | public function handle() |
||
15 | { |
||
16 | $user = $this->argument('user'); |
||
17 | |||
18 | if($this->askResult($user)){ |
||
19 | UserProviderFacade::deleteAdmin($user); |
||
20 | $this->info('Admin was removed successfully'); |
||
21 | return; |
||
22 | } |
||
23 | |||
24 | $this->warn('Process was canceled'); |
||
25 | } |
||
26 | |||
27 | public function askResult($user) |
||
28 | { |
||
29 | if($this->option('force')) { |
||
30 | return true; |
||
31 | } |
||
32 | |||
33 | return $this->confirm("Do you want to remove {$user} from administration", 'yes'); |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
34 | } |
||
35 | } |
||
36 |