Skip to content

Commit

Permalink
User can be null
Browse files Browse the repository at this point in the history
  • Loading branch information
francoism90 authored Oct 10, 2024
1 parent 5a72bb0 commit 1c18abf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Auth/Concerns/WithAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ protected function getAuthKey(): int|string|null

protected function can(string $ability, mixed $arguments = []): bool
{
return $this->getAuthUser()->can($ability, $arguments);
return $this->getAuthUser()?->can($ability, $arguments);
}

protected function cannot(string $ability, mixed $arguments = []): bool
{
return $this->getAuthUser()->cannot($ability, $arguments);
return $this->getAuthUser()?->cannot($ability, $arguments);
}
}

0 comments on commit 1c18abf

Please sign in to comment.