public function json($data = [], $status = 200, array $headers = [], $options = 0)
{
if ($data instanceof Arrayable) {
$data = $data->toArray();
}
return new JsonResponse($data, $status, $headers, $options);
}
/** * 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()); }