getHeaderLine('Authorization'); if (empty($authorization)){ return $this->response->json( $this->apiReturn->error(ApiCode::getMessage(ApiCode::LOGIN_ERROR), ApiCode::LOGIN_ERROR) ); } $authorization = str_replace("Bearer ", "", $authorization); $userJwt = $this->cryptoFactory->cryptoClass('jwt', $authorization)->decrypt(); if (empty($userJwt)) { return $this->response->json( $this->apiReturn->error(ApiCode::getMessage(ApiCode::LOGIN_TOKEN_ERROR), ApiCode::LOGIN_TOKEN_ERROR) ); } Context::set('user_id',$userJwt['data']->id); return $handler->handle($request); } }