gearbox-solutions / eloquent-filemaker

A Model extension and Eloquent driver for Laravel connecting to FileMaker through the Data API
https://gearboxgo.com
MIT License
54 stars 16 forks source link

Fix for multiple attribute mutator support #75

Closed alexandrosraikos closed 2 hours ago

alexandrosraikos commented 1 month ago

So far, I was able to make a custom model accessor value for multiple attributes using get following the official guide.

However, Mutating Multiple Attributes was breaking because the FMHasAttributes model override method assumed the custom $key was part of the attributes array. That's not always the case with multiple attribute accessors and mutators.

This is a proposed fix using Laravel's native hasAttributeSetMutator to check using reflection classes if this is a client-only attribute definition.