diff --git a/src/JsonResource.php b/src/JsonResource.php index dfda972..8a84b4e 100644 --- a/src/JsonResource.php +++ b/src/JsonResource.php @@ -52,7 +52,7 @@ public function collection(): Response $this->process(); if (is_null($this->perPage)) - return json([ + return response()->json([ 'data' => $this->response , ]); @@ -61,7 +61,7 @@ public function collection(): Response 'perPage' => $this->perPage ]); - return json([ + return response()->json([ 'data' => $this->response , 'meta' => $this->meta ]); @@ -70,16 +70,16 @@ public function collection(): Response public function single(): Response { if (is_null($this->data)) - return json([ + return response()->json([ 'data' => [] ]); if ($this->data instanceof Collection) - return json([ + return response()->json([ 'data' => $this->toArray($this->data->first()) ]); - return json([ + return response()->json([ 'data' => $this->toArray($this->data) ]); }