@@ 35-50 (lines=16) @@ | ||
32 | * @throws PermissionDoesNotExistsException |
|
33 | * @throws PermissionIsAttachedException |
|
34 | */ |
|
35 | public function make(Permission $permission): bool |
|
36 | { |
|
37 | $exists = $this->exists->make($permission); |
|
38 | ||
39 | if ($exists === false) { |
|
40 | throw new PermissionDoesNotExistsException; |
|
41 | } |
|
42 | ||
43 | $attached = $this->attached->make($permission); |
|
44 | ||
45 | if ($attached === true) { |
|
46 | throw new PermissionIsAttachedException; |
|
47 | } |
|
48 | ||
49 | return $this->delete->make($permission); |
|
50 | } |
|
51 | } |
|
52 |
@@ 35-50 (lines=16) @@ | ||
32 | * @throws RoleDoesNotExistsException |
|
33 | * @throws RoleIsAttachedException |
|
34 | */ |
|
35 | public function make(Role $role): bool |
|
36 | { |
|
37 | $exists = $this->exists->make($role); |
|
38 | ||
39 | if ($exists === false) { |
|
40 | throw new RoleDoesNotExistsException; |
|
41 | } |
|
42 | ||
43 | $attached = $this->attached->make($role); |
|
44 | ||
45 | if ($attached === true) { |
|
46 | throw new RoleIsAttachedException; |
|
47 | } |
|
48 | ||
49 | return $this->delete->make($role); |
|
50 | } |
|
51 | } |
|
52 |