Skip to content

Commit 2bdc711

Browse files
committed
Fixes #17
1 parent 2f36109 commit 2bdc711

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Collection.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Matchory\Elasticsearch;
66

7+
use Illuminate\Contracts\Support\Arrayable;
78
use Illuminate\Support\Collection as BaseCollection;
89
use JsonException;
910
use stdClass;
@@ -145,7 +146,9 @@ public function getShards(): ?stdClass
145146
public function toArray(): array
146147
{
147148
return array_map(static function ($item): array {
148-
return $item->toArray();
149+
return $item instanceof Arrayable
150+
? $item->toArray()
151+
: $item;
149152
}, $this->items);
150153
}
151154

0 commit comments

Comments
 (0)