[12.x] Add InteractsWithData trait to ComponentAttributeBag#56452
[12.x] Add InteractsWithData trait to ComponentAttributeBag#56452taylorotwell merged 2 commits intolaravel:12.xfrom
InteractsWithData trait to ComponentAttributeBag#56452Conversation
|
Are there slight breaking changes here around dot notation since the previous example uses array_key_exists and InteractsWithData uses Arr::has for example. |
|
Hey @taylorotwell, that's a good concern and very well pointed out. However, I couldn't find any case where this would be an issue for us, because Can we have someone else double-check my assumptions? (This person could be you, of course. :D) I've also submitted some more unit tests to validate if we're handling attributes with dots correctly. In any case, I'm open to making the required changes, like keeping the original |
This PR adds the
InteractsWithDatatrait toComponentAttributeBag, giving developers cleaner ways to work with Blade component attributes.Why this change?
Working with component attributes currently requires a lot of boilerplate:
What's new?
By reusing
InteractsWithData, we gain many powerful methods.✅ Simple validation methods
🎯 Type casting that just works
🌟 Card component with dynamic link