How make setter and getter on adonisjs 6 #4594
Unanswered
adityadarma
asked this question in
Help
Replies: 1 comment
-
Hey @adityadarma! 👋🏻 I am not sure what you mean, but if you want to transform the value before and after fetching it from the database, you can use the Example: @column({
serializeAs: null,
prepare: (value: string | null) => (value ? encryption.encrypt(value) : null),
consume: (value: string | null) => (value ? encryption.decrypt(value) : null),
})
public shopifyToken: string | null~ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi team
i will make setter and getter like laravel (getAttribute and setAttribute), i will make encryption database when condition save data will encrypt and get data will decrypt
i have try with decorator afterFind and afterFetch, but cant success
Beta Was this translation helpful? Give feedback.
All reactions