| @@ 266-279 (lines=14) @@ | ||
| 263 | * @return bool |
|
| 264 | * @throws \Exception |
|
| 265 | */ |
|
| 266 | public function hasAnyPermission(...$permissions): bool |
|
| 267 | { |
|
| 268 | if (is_array($permissions[0])) { |
|
| 269 | $permissions = $permissions[0]; |
|
| 270 | } |
|
| 271 | ||
| 272 | foreach ($permissions as $permission) { |
|
| 273 | if ($this->checkPermissionTo($permission)) { |
|
| 274 | return true; |
|
| 275 | } |
|
| 276 | } |
|
| 277 | ||
| 278 | return false; |
|
| 279 | } |
|
| 280 | ||
| 281 | /** |
|
| 282 | * Determine if the model has all of the given permissions. |
|
| @@ 289-302 (lines=14) @@ | ||
| 286 | * @return bool |
|
| 287 | * @throws \Exception |
|
| 288 | */ |
|
| 289 | public function hasAllPermissions(...$permissions): bool |
|
| 290 | { |
|
| 291 | if (is_array($permissions[0])) { |
|
| 292 | $permissions = $permissions[0]; |
|
| 293 | } |
|
| 294 | ||
| 295 | foreach ($permissions as $permission) { |
|
| 296 | if (! $this->hasPermissionTo($permission)) { |
|
| 297 | return false; |
|
| 298 | } |
|
| 299 | } |
|
| 300 | ||
| 301 | return true; |
|
| 302 | } |
|
| 303 | ||
| 304 | /** |
|
| 305 | * Determine if the model has, via roles, the given permission. |
|