Skip to content

[10.x] Make ComponentAttributeBag JsonSerializable - #48338

Merged
taylorotwell merged 4 commits into
laravel:10.xfrom
iamgergo:10.x
Sep 8, 2023
Merged

[10.x] Make ComponentAttributeBag JsonSerializable#48338
taylorotwell merged 4 commits into
laravel:10.xfrom
iamgergo:10.x

Conversation

@iamgergo

@iamgergo iamgergo commented Sep 8, 2023

Copy link
Copy Markdown
Contributor

Currently it is not possible to automatically convert to array or JSON serialize the ComponentAttributeBag, but in some cases it would be handy.

json_encode(['attributes' => new ComponentAttributeBag(['class' => 'form-control'])]);

// {"attributes":{}}

We can use (new ComponentAttributeBag(['class' => 'form-control']))->getAttributes(), but it would be a better DX to handle this automatically, in my opinion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants