From 18af5f6f259d043c2377f15ddab249192059c45c Mon Sep 17 00:00:00 2001 From: Amir Date: Fri, 27 Aug 2021 13:07:37 +0430 Subject: [PATCH] bug fix in src/JsonResource.php --- src/JsonResource.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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) ]); }