| @@ 178-191 (lines=14) @@ | ||
| 175 | * @return bool |
|
| 176 | * @throws \Exception |
|
| 177 | */ |
|
| 178 | public function hasAnyPermission(...$permissions): bool |
|
| 179 | { |
|
| 180 | if (is_array($permissions[0])) { |
|
| 181 | $permissions = $permissions[0]; |
|
| 182 | } |
|
| 183 | ||
| 184 | foreach ($permissions as $permission) { |
|
| 185 | if ($this->checkPermissionTo($permission)) { |
|
| 186 | return true; |
|
| 187 | } |
|
| 188 | } |
|
| 189 | ||
| 190 | return false; |
|
| 191 | } |
|
| 192 | ||
| 193 | /** |
|
| 194 | * Determine if the model has all of the given permissions. |
|
| @@ 201-214 (lines=14) @@ | ||
| 198 | * @return bool |
|
| 199 | * @throws \Exception |
|
| 200 | */ |
|
| 201 | public function hasAllPermissions(...$permissions): bool |
|
| 202 | { |
|
| 203 | if (is_array($permissions[0])) { |
|
| 204 | $permissions = $permissions[0]; |
|
| 205 | } |
|
| 206 | ||
| 207 | foreach ($permissions as $permission) { |
|
| 208 | if (! $this->hasPermissionTo($permission)) { |
|
| 209 | return false; |
|
| 210 | } |
|
| 211 | } |
|
| 212 | ||
| 213 | return true; |
|
| 214 | } |
|
| 215 | ||
| 216 | /** |
|
| 217 | * Determine if the model has, via roles, the given permission. |
|