Skip to content

Commit

Permalink
Fix GuardDoesNotMatch should accept collection
Browse files Browse the repository at this point in the history
  • Loading branch information
erikn69 authored Oct 30, 2024
1 parent 28a9442 commit 7cd173b
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 7cd173b

Please sign in to comment.