Issues (62)

src/AuthenticationHandler.php (1 issue)

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
The property jsonApiResponse does not exist on SMartins\JsonHandler\AuthenticationHandler. Did you maybe forget to declare it?
Loading history...
20
        $this->jsonApiResponse->setErrors($error);
21
    }
22
}
23