diff --git a/src/Models/Role.php b/src/Models/Role.php index e29e2d44..6bd47b75 100644 --- a/src/Models/Role.php +++ b/src/Models/Role.php @@ -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());