Issues (17)

src/Commands/UserActions/DeleteAdmin.php (1 issue)

Labels
Severity
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
'yes' of type string is incompatible with the type boolean expected by parameter $default of Illuminate\Console\Command::confirm(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

33
        return $this->confirm("Do you want to remove {$user} from administration", /** @scrutinizer ignore-type */ 'yes');
Loading history...
34
    }
35
}
36