Exemple #1
0
 /**
  * Generic response.
  *
  * @api
  * @param array|null $payload
  * @return \Illuminate\Contracts\Http\Response
  */
 public function respond($payload)
 {
     if ($meta = $this->getMeta()) {
         $payload = array_merge($payload, ['meta' => $meta]);
     }
     return !($callback = $this->request->input('callback')) ? $this->response->json($payload, $this->getStatusCode(), $this->getHeaders()) : $this->response->jsonp($callback, $payload, $this->getStatusCode(), $this->getHeaders());
 }
Exemple #2
0
 /**
  * Generic response.
  *
  * @api
  * @param array|null $payload
  * @return \Illuminate\Contracts\Http\Response
  */
 public function respond($payload = [])
 {
     if ($meta = $this->getMeta()) {
         $payload = array_merge($payload, ['meta' => $meta]);
     }
     $statusCode = config('api.suppress_response_code') === true ? StatusCode::OK : $this->getStatusCode();
     return !($callback = $this->request->input('callback')) ? $this->response->json($payload, $statusCode, $this->getHeaders(), JSON_PRETTY_PRINT) : $this->response->jsonp($callback, $payload, $statusCode, $this->getHeaders());
 }