From 1760f21c8aecd4d370893539553f27e7b362212c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=2E=20Nagy=20Gerg=C5=91?= Date: Sat, 30 Dec 2023 13:36:49 +0100 Subject: [PATCH] [10.x] Make ComponentAttributeBag Arrayable --- src/Illuminate/View/ComponentAttributeBag.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Illuminate/View/ComponentAttributeBag.php b/src/Illuminate/View/ComponentAttributeBag.php index 3c3d1a27dbff..b5302e3e3ec4 100644 --- a/src/Illuminate/View/ComponentAttributeBag.php +++ b/src/Illuminate/View/ComponentAttributeBag.php @@ -4,6 +4,7 @@ use ArrayAccess; use ArrayIterator; +use Illuminate\Contracts\Support\Arrayable; use Illuminate\Contracts\Support\Htmlable; use Illuminate\Support\Arr; use Illuminate\Support\HtmlString; @@ -14,7 +15,7 @@ use JsonSerializable; use Traversable; -class ComponentAttributeBag implements ArrayAccess, IteratorAggregate, JsonSerializable, Htmlable +class ComponentAttributeBag implements Arrayable, ArrayAccess, IteratorAggregate, JsonSerializable, Htmlable { use Conditionable, Macroable; @@ -486,6 +487,16 @@ public function jsonSerialize(): mixed return $this->attributes; } + /** + * Convert the object into an array. + * + * @return array + */ + public function toArray() + { + return $this->attributes; + } + /** * Implode the attributes into a single HTML ready string. *