public function handle(Request $request, Closure $next)
    {
        $header = $request->header(self::AUTH_HEADER);
        $apiKey = ApiKey::getByKey($header);

        if ($apiKey instanceof ApiKey) {
            $this->logAccessEvent($request, $apiKey);
            return $next($request);
        }

        return response([
            'errors' => [[
                'message' => 'Unauthorized'
            ]]
        ], 401);
    }
public function handle(Request $request, Closure $next)
    {
        $header = $request->header(self::AUTH_HEADER);
        $apiKey = ApiKey::getByKey($header);

        if ($apiKey instanceof ApiKey) {
            $this->logAccessEvent($request, $apiKey);
            return $next($request);
        }

        return response([
            'errors' => [[
                'message' => 'Unauthorized'
            ]]
        ], 401);
    }
public function handle ( Request $ request , Closure $ next ) { $ header = $ request -> header ( self :: AUTH_HEADER ) ; $ apiKey = ApiKey :: getByKey ( $ header ) ; if ( $ apiKey instanceof ApiKey ) { $ this -> logAccessEvent ( $ request , $ apiKey ) ; return $ next ( $ request ) ; } return response ( [ 'errors' => [ [ 'message' => 'Unauthorized' ] ] ] , 401 ) ; }
Handle the incoming request

@param Request $request
@param Closure $next
@return \Illuminate\Contracts\Routing\ResponseFactory|mixed|\Symfony\Component\HttpFoundation\Response
Handle the incoming request