Skip to content

Commit f03072a

Browse files
authored
Update Arrayable.php
1 parent 4a46895 commit f03072a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/Traits/Arrayable.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ trait Arrayable
1010

1111
public static function makeAttribute(array $attributes = [])
1212
{
13-
$instance = new class implements \ArrayAccess
13+
$instance = new class implements \ArrayAccess, \IteratorAggregate
1414
{
1515
use Arrayable;
1616
};
@@ -71,4 +71,9 @@ public function toArray()
7171
{
7272
return $this->getAttributes();
7373
}
74+
75+
public function getIterator(): \ArrayIterator
76+
{
77+
return new \ArrayIterator($this->toArray());
78+
}
7479
}

0 commit comments

Comments
 (0)