protected function buildResponse($data, $headers = [], $options = 0)
    {   
        $headers = array_merge($headers, $this->headers);

        $response = $data instanceof JsonResource
            ? $data->toResponse($this->request)
            : new JsonResponse($data, $this->getStatusCode(), $headers, $options);

        $response->setStatusCode($this->getStatusCode());

        return $response;
    }
protected function buildResponse($data, $headers = [], $options = 0)
    {   
        $headers = array_merge($headers, $this->headers);

        $response = $data instanceof JsonResource
            ? $data->toResponse($this->request)
            : new JsonResponse($data, $this->getStatusCode(), $headers, $options);

        $response->setStatusCode($this->getStatusCode());

        return $response;
    }
protected function buildResponse ( $ data , $ headers = [ ] , $ options = 0 ) { $ headers = array_merge ( $ headers , $ this -> headers ) ; $ response = $ data instanceof JsonResource ? $ data -> toResponse ( $ this -> request ) : new JsonResponse ( $ data , $ this -> getStatusCode ( ) , $ headers , $ options ) ; $ response -> setStatusCode ( $ this -> getStatusCode ( ) ) ; return $ response ; }
Build response object

@param mixed $data
@param array $headers
@param int $options
@return JsonResponse
Build response object