Replies: 1 comment 1 reply
-
I think computed properties in Laravel are kinda of an anti-pattern, your IDE doesn't have any idea what's happening and it relies on a lot of magic. Adding computed properties like you describe also seems a lot of work I'm not willing to do at the moment, if it can be done by including a trait (which should I think be possible) maybe I'll add it in to the package as an optional feature which can be added. But this is a huge effort if you want to get the details right (transformation, validation, name mapping, ....) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I noticed v3.5.0 introduced
Computed
properties, however these seem to be very limited in their usage:Ideally, we could provide
Closure
for the computed property, and when the property is accessed, the closure is evaluated and the result is returned - pretty much the same as Laravel model accessors.Perhaps something like the example below. The implementation could also be totally different - this just illustrates the idea:
Beta Was this translation helpful? Give feedback.
All reactions