Closed lekhnath closed 9 months ago
i think you're referring to mutators and accessors. if not ill reopen
https://orm.masoniteproject.com/models#accessors-and-mutators-getter-and-setter
if you want to seect this you would have to use the add_select clause for the query builder. if you want the logic in the model you could use a scope and add it there
Describe the feature as you'd like to see it Define computed property on Models
What do we currently have to do now?
Additional context This is just an example but it would be nice if we could define custom properties on model and also select these property dynamically using the select method. I've tried using __cast_map__ I could not manage to get the desired result. It is not selectable and the value returned from
get
method ofCaster
class also did not reflect in result.Demo implementation of __cast_map__: