1 | <?php |
||
2 | |||
3 | namespace Maklad\Permission\Commands; |
||
4 | |||
5 | use Illuminate\Console\Command; |
||
6 | use Maklad\Permission\Contracts\RoleInterface as Role; |
||
7 | |||
8 | /** |
||
9 | * Class CreateRole |
||
10 | * @package Maklad\Permission\Commands |
||
11 | */ |
||
12 | class CreateRole extends Command |
||
13 | { |
||
14 | protected $signature = 'permission:create-role |
||
15 | {name : The name of the role} |
||
16 | {guard? : The name of the guard} |
||
17 | {--permission=* : The name of the permission}'; |
||
18 | |||
19 | protected $description = 'Create a role'; |
||
20 | |||
21 | 4 | public function handle() |
|
22 | { |
||
23 | 4 | $roleClass = \app(\config('permission.models.role')); |
|
24 | |||
25 | 4 | $name = $this->argument('name'); |
|
26 | 4 | $guard = $this->argument('guard'); |
|
27 | 4 | $permissions = $this->option('permission'); |
|
28 | |||
29 | 4 | $role = $roleClass::create([ |
|
0 ignored issues
–
show
|
|||
30 | 4 | 'name' => $name, |
|
31 | 4 | 'guard_name' => $guard |
|
32 | ]); |
||
33 | |||
34 | 4 | $this->info("Role `{$role->name}` created"); |
|
35 | |||
36 | 4 | $role->givePermissionTo($permissions); |
|
37 | 4 | $permissionsStr = $role->permissions->implode('name', '`, `'); |
|
38 | 4 | $this->info("Permissions `{$permissionsStr}` has been given to role `{$role->name}`"); |
|
39 | 4 | } |
|
40 | } |
||
41 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.