Skip to content

Commit

Permalink
Merge pull request #2748 from erikn69/patch-52
Browse files Browse the repository at this point in the history
Fix GuardDoesNotMatch should accept collection
  • Loading branch information
drbyte authored Oct 30, 2024
2 parents bb4c60b + 7cd173b commit 0680e7c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Models/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function hasPermissionTo($permission, ?string $guardName = null): bool
$permission = $this->filterPermission($permission, $guardName);

if (! $this->getGuardNames()->contains($permission->guard_name)) {
throw GuardDoesNotMatch::create($permission->guard_name, $guardName ?? $this->getGuardNames());
throw GuardDoesNotMatch::create($permission->guard_name, $guardName ? collect([$guardName]) : $this->getGuardNames());
}

return $this->permissions->contains($permission->getKeyName(), $permission->getKey());
Expand Down

0 comments on commit 0680e7c

Please sign in to comment.