Computed property for setter #1585
Unanswered
exenestecnico
asked this question in
Help
Replies: 1 comment 1 reply
-
As I understand, computed properties can only be read only. Did you try hooks for your use case? |
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
-
Im using Adonis 4.1. Any way to have a setter that sets more than one property in the model? Like the oposite of a computed property.
I have this table
I send the representative_name and representative_position fields to the frontend as
representative: { name, position }
. For this purpose I used a computed property in the model.I would like to be also able to set the representative object that comes from the frontend on create or update, and that the corresponding fields are set in the model.
This is the way I'm currently setting and getting model values:
Any way I can make a setter in StatalClient model so I dont have to extract the values from representative object before passing them to the model? As I'm doing with:
I would like to do
await client.statal().create({ contract, REEUP, organism, representative })
Beta Was this translation helpful? Give feedback.
All reactions