CreatePermission::handle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 8
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Spatie\Permission\Commands;
4
5
use Illuminate\Console\Command;
6
use Spatie\Permission\Contracts\Permission as PermissionContract;
7
8
class CreatePermission extends Command
9
{
10
    protected $signature = 'permission:create-permission 
11
                {name : The name of the permission} 
12
                {guard? : The name of the guard}';
13
14
    protected $description = 'Create a permission';
15
16
    public function handle()
17
    {
18
        $permissionClass = app(PermissionContract::class);
19
20
        $permission = $permissionClass::findOrCreate($this->argument('name'), $this->argument('guard'));
21
22
        $this->info("Permission `{$permission->name}` created");
23
    }
24
}
25