diff --git a/src/JsonResource.php b/src/JsonResource.php index 58d7ff6..dfda972 100644 --- a/src/JsonResource.php +++ b/src/JsonResource.php @@ -25,10 +25,15 @@ public function __construct(Collection|Paginator|stdClass|array|null $data , int $this->perPage = $perPage; } - public function reletional(): array + public function dontJson(): array|null { - $this->process(); + if (is_null($this->data)) + return null; + if ($this->data instanceof stdClass) + return $this->toArray($this->data); + + $this->process(); return $this->response; }