Skip to content

Commit

Permalink
It's possible to have an auth gate response with a null code in som…
Browse files Browse the repository at this point in the history
…e situations (#65)
  • Loading branch information
specialtactics committed May 24, 2023
1 parent 3cf58a5 commit a7c4a2c
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ public function userCan($ability, $arguments = [])
// @var $response \Illuminate\Auth\Access\Response
$response = app(Gate::class)->forUser($user)->inspect($ability, $arguments);
if (! empty($response->message())) {
throw new HttpException($response->code(), $response->message());
$responseCode = $response->code() ?? 403;
throw new HttpException($responseCode, $response->message());
}

return false;
Expand Down

0 comments on commit a7c4a2c

Please sign in to comment.