From bbc6227220bc76cb6025d915009ec29b2d0a028d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Tue, 19 Oct 2021 18:23:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Collection.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Collection.php b/src/Collection.php index 4ad0f7d..48b8d6f 100644 --- a/src/Collection.php +++ b/src/Collection.php @@ -148,11 +148,12 @@ class Collection extends AbstractCollection public function toArray(): array { $array = []; + /** @var Model $value */ foreach ($this as $value) { if (!is_object($value)) { continue; } - $array[] = $value->toArray(); + $array[] = $value->setWith($this->query->with)->toArray(); } $this->_item = []; return $array;