Better default support for Laravel Accessors and Mutators #4930
Replies: 2 comments 3 replies
-
I don't know anywhere that accessors and mutators don't work, except database-powered sorting and searching. If you can think of any other places please let me know. For sorting and searching, you can pass in an array of underlying database columns to |
Beta Was this translation helpful? Give feedback.
-
For virtual columns, i.e. mutators for attributes that to not have a corresponding database column, I had to add the attribute name to the |
Beta Was this translation helpful? Give feedback.
-
Hi,
first of all, I would like to thank you all for the amazing job you're doing on Filament. ❤️
I just have one minor request and it has to do with using Laravel accessors and mutators, which I would love to see working in Filament v3.
I am aware that there are currently workarounds for simple string concatenation within a table column or the work can be pushed directly to the
virtualAs
function within a migration. However, accessors and mutators are still a core competency even among junior Laravel developers, and therefore much more accessible to them.Where I see this used the most is not just in simple string concatenation operations, but also in e.g. the common work of trying to store monetary values as integers, where the transformation logic is commonly stored within an accessor & mutator pair on the model.
Didn't want to open this one as an issue, but would really love to hear the thoughts of the core team on this and how tricky it would be to implement in Filament.
Thanks again,
g
Beta Was this translation helpful? Give feedback.
All reactions