@@ 104-118 (lines=15) @@ | ||
101 | * @return $this |
|
102 | * @throws \Maklad\Permission\Exceptions\GuardDoesNotMatch |
|
103 | */ |
|
104 | public function revokePermissionTo(...$permissions) |
|
105 | { |
|
106 | collect($permissions) |
|
107 | ->flatten() |
|
108 | ->map(function ($permission) { |
|
109 | $permission = $this->getStoredPermission($permission); |
|
110 | $this->permissions()->detach($permission); |
|
111 | ||
112 | return $permission; |
|
113 | }); |
|
114 | ||
115 | $this->forgetCachedPermissions(); |
|
116 | ||
117 | return $this; |
|
118 | } |
|
119 | ||
120 | /** |
|
121 | * @param string|Permission $permission |
@@ 89-103 (lines=15) @@ | ||
86 | * |
|
87 | * @return array|Role|string |
|
88 | */ |
|
89 | public function removeRole(...$roles) |
|
90 | { |
|
91 | \collect($roles) |
|
92 | ->flatten() |
|
93 | ->map(function ($role) { |
|
94 | $role = $this->getStoredRole($role); |
|
95 | $this->roles()->detach($role); |
|
96 | ||
97 | return $role; |
|
98 | }); |
|
99 | ||
100 | $this->forgetCachedPermissions(); |
|
101 | ||
102 | return $roles; |
|
103 | } |
|
104 | ||
105 | /** |
|
106 | * Remove all current roles and set the given ones. |