CreatePermission   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 8 1
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