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(); } }