Completed
Push — master ( 029fc1...afa99c )
by guillaume
12:29 queued 06:09
created

GiveAdminRole   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A handle() 0 5 1
A __construct() 0 3 1
1
<?php
2
3
namespace App\Console\Commands\Debug;
4
5
use App\User;
6
use Illuminate\Console\Command;
7
8
class GiveAdminRole extends Command
9
{
10
    protected $signature = 'debug:give-admin-role {email}';
11
12
    protected $description = 'Give admin role to the user (email) given';
13
14
    public function __construct()
15
    {
16
        parent::__construct();
17
    }
18
19
    public function handle()
20
    {
21
        $email = $this->argument('email');
22
        $user = User::where('email', $email)->first();
23
        $user->assignRole(['admin']);
24
    }
25
}
26