1 | <?php |
||
2 | |||
3 | namespace SMartins\JsonHandler; |
||
4 | |||
5 | use Illuminate\Auth\AuthenticationException; |
||
6 | |||
7 | trait AuthenticationHandler |
||
8 | { |
||
9 | public function authenticationException(AuthenticationException $exception) |
||
10 | { |
||
11 | $error = [[ |
||
12 | 'status' => 401, |
||
13 | 'code' => $this->getCode('authentication'), |
||
14 | 'source' => ['pointer' => $exception->getFile().':'.$exception->getLine()], |
||
15 | 'title' => $exception->getMessage(), |
||
16 | 'detail' => __('exception::exceptions.authentication.detail'), |
||
17 | ]]; |
||
18 | |||
19 | $this->jsonApiResponse->setStatus(401); |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
20 | $this->jsonApiResponse->setErrors($error); |
||
21 | } |
||
22 | } |
||
23 |