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;