Skip to content

Commit a5f661f

Browse files
authored
[10.x] Make ComponentAttributeBag Arrayable (#49524)
1 parent ae79bf0 commit a5f661f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Illuminate/View/ComponentAttributeBag.php

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

55
use ArrayAccess;
66
use ArrayIterator;
7+
use Illuminate\Contracts\Support\Arrayable;
78
use Illuminate\Contracts\Support\Htmlable;
89
use Illuminate\Support\Arr;
910
use Illuminate\Support\HtmlString;
@@ -14,7 +15,7 @@
1415
use JsonSerializable;
1516
use Traversable;
1617

17-
class ComponentAttributeBag implements ArrayAccess, IteratorAggregate, JsonSerializable, Htmlable
18+
class ComponentAttributeBag implements Arrayable, ArrayAccess, IteratorAggregate, JsonSerializable, Htmlable
1819
{
1920
use Conditionable, Macroable;
2021

@@ -486,6 +487,16 @@ public function jsonSerialize(): mixed
486487
return $this->attributes;
487488
}
488489

490+
/**
491+
* Convert the object into an array.
492+
*
493+
* @return array
494+
*/
495+
public function toArray()
496+
{
497+
return $this->attributes;
498+
}
499+
489500
/**
490501
* Implode the attributes into a single HTML ready string.
491502
*

0 commit comments

Comments
 (0)