protected function success(array $data, $code = 200)
    {
        $this->response->setStatusCode($code);
        $this->response->headers->add(['Content-Type' => 'application/json']);
        $this->response->setContent(json_encode(['success' => $data], JSON_PRETTY_PRINT));

        return $this->response;
    }