Skip to content

Commit 76dd153

Browse files
authored
Merge pull request #2248 from mtawil/patch-1
Don't throw an exception when checking hasAllPermissions()
2 parents ddaeda1 + a1e4463 commit 76dd153

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Traits/HasPermissions.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,13 @@ public function hasAnyPermission(...$permissions): bool
249249
* @param string|int|array|\Spatie\Permission\Contracts\Permission|\Illuminate\Support\Collection ...$permissions
250250
*
251251
* @return bool
252-
* @throws \Exception
253252
*/
254253
public function hasAllPermissions(...$permissions): bool
255254
{
256255
$permissions = collect($permissions)->flatten();
257256

258257
foreach ($permissions as $permission) {
259-
if (! $this->hasPermissionTo($permission)) {
258+
if (! $this->checkPermissionTo($permission)) {
260259
return false;
261260
}
262261
}
@@ -486,6 +485,7 @@ public function forgetCachedPermissions()
486485

487486
/**
488487
* Check if the model has All of the requested Direct permissions.
488+
*
489489
* @param string|int|array|\Spatie\Permission\Contracts\Permission|\Illuminate\Support\Collection ...$permissions
490490
* @return bool
491491
*/
@@ -504,6 +504,7 @@ public function hasAllDirectPermissions(...$permissions): bool
504504

505505
/**
506506
* Check if the model has Any of the requested Direct permissions.
507+
*
507508
* @param string|int|array|\Spatie\Permission\Contracts\Permission|\Illuminate\Support\Collection ...$permissions
508509
* @return bool
509510
*/

0 commit comments

Comments
 (0)