Passed
Push — master ( d2ddcd...7d7316 )
by Reza
04:17
created

MakeAdmin   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 12 3
1
<?php
2
3
namespace EasyPanel\Commands\UserActions;
4
5
use EasyPanel\Support\Contract\UserProviderFacade;
6
use Illuminate\Console\Command;
7
8
class MakeAdmin extends Command
9
{
10
11
    protected $description = 'Register an new admin';
12
13
    protected $signature = 'panel:add {user}';
14
15
    public function handle()
16
    {
17
        $user = $this->argument('user');
18
        try{
19
            $status = UserProviderFacade::makeAdmin($user);
20
            if($status){
21
                $this->info("User {$user} was converted to an admin");
22
                return;
23
            }
24
            $this->warn("It was failed, be sure your column is fillable.");
25
        } catch (\Exception $exception){
26
            $this->error("User {$user} does not exist");
27
        }
28
    }
29
30
}
31