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