/**
  * Add currently built result to the response object.
  *
  * @param $code
  */
 private function addToResponse($code)
 {
     $this->response->setStatusCode($code);
     $this->response->setData($this->result);
 }
Ejemplo n.º 2
0
 /**
  * Intercepts data to be set to JSON and includes additional information.
  *
  * @param  mixed $data
  * @return JsonResponse
  * @throws \InvalidArgumentException
  */
 public function setData($data = array())
 {
     $fullData = $this->siblingContent;
     $fullData['data'] = $data;
     return parent::setData($fullData);
 }
Ejemplo n.º 3
0
 /**
  * @param array $data
  * @return JsonResponse
  */
 public function setData($data = [])
 {
     $resp = ['status' => $this->getStatusCode() == 200 ? 'success' : 'error', 'statusCode' => $this->getStatusCode()];
     return parent::setData(array_merge($data, $resp));
 }