CODE_NOT_FOUND = 'GEN-LPF2FV6'; const CODE_INTERNAL_ERROR = 'GEN-A9AR4H'; const CODE_UNAUTHORIZED = 'GEN-M36UI'; const CODE_FORBIDDEN = ‘GEN-23T7'; protected function respondWithError($message, $errorCode) { return $this->respondWithArray([ 'error' => [ 'code' => $errorCode, 'http_code' => $this->statusCode, 'message' => $message, ] ]); } public function errorNotFound($message = 'Resource Not Found') { return $this->setStatusCode(404)->respondWithError($message, self::CODE_NOT_FOUND); } public function errorUnauthorized($message = 'Unauthorized') { return $this->setStatusCode(401)->respondWithError($message, self::CODE_UNAUTHORIZED); } //errorForbidden, errorInternalError, …