| Total Complexity | 4 |
| Total Lines | 26 |
| Duplicated Lines | 0 % |
| Coverage | 14.29% |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class AuthorizationService implements AuthorizationContract |
||
| 16 | { |
||
| 17 | public function createRole(string $role, array $permissions): Role |
||
| 18 | { |
||
| 19 | $role = Role::create([ |
||
| 20 | 'name' => $role, |
||
| 21 | 'guard_name' => 'api', |
||
| 22 | ]); |
||
| 23 | $role->givePermissionTo($permissions); |
||
| 24 | |||
| 25 | return $role; |
||
| 26 | } |
||
| 27 | |||
| 28 | public function createPermissions(array $permissions): void |
||
| 29 | { |
||
| 30 | foreach ($permissions as $permission) { |
||
| 31 | Permission::create([ |
||
| 32 | 'name' => $permission, |
||
| 33 | 'guard_name' => 'api', |
||
| 34 | ]); |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | 43 | public function clearPermissionCache() :void |
|
| 41 | 43 | } |
|
| 42 | } |
||
| 43 |