From ff05d714d78ae1e7d84a19e30f9564811660d100 Mon Sep 17 00:00:00 2001 From: Franck DAKIA Date: Mon, 21 Aug 2023 02:08:59 +0000 Subject: [PATCH] Fixes collection as json --- src/Database/Collection.php | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/Database/Collection.php b/src/Database/Collection.php index b91b61bd..01770f77 100644 --- a/src/Database/Collection.php +++ b/src/Database/Collection.php @@ -73,13 +73,7 @@ public function dropAll(): void */ public function __toString(): string { - $data = []; - - foreach ($this->toArray() as $model) { - $data[] = $model->toArray(); - } - - return json_encode($data); + return json_encode($this->all()); } /** @@ -87,12 +81,6 @@ public function __toString(): string */ public function jsonSerialize(): array { - $data = []; - - foreach ($this->toArray() as $model) { - $data[] = $model->toArray(); - } - - return $data; + return $this->all(); } }