protected function response($data, $statusCode = 200, array $headers = [])
    {
        if ($data instanceof Arrayable && !$data instanceof JsonSerializable) {
            $data = $data->toArray();
        }

        return new JsonResponse($data, $statusCode, $headers);
    }
protected function response($data, $statusCode = 200, array $headers = [])
    {
        if ($data instanceof Arrayable && !$data instanceof JsonSerializable) {
            $data = $data->toArray();
        }

        return new JsonResponse($data, $statusCode, $headers);
    }
protected function response ( $ data , $ statusCode = 200 , array $ headers = [ ] ) { if ( $ data instanceof Arrayable && ! $ data instanceof JsonSerializable ) { $ data = $ data -> toArray ( ) ; } return new JsonResponse ( $ data , $ statusCode , $ headers ) ; }
Create a json response
@param  mixed  $data
@param  integer $statusCode
@param  array  $headers
@return Illuminate\Http\JsonResponse
Create a json response