Getter Function cannot use with underscore in the field


#1

My database field is c_createDate

Here is my getter function

getC_createDate(date) {
    return 'test'
  }

the getter function isn’t executed at all.
Is there any way to make it work?


#2

ref: https://adonisjs.com/docs/4.1/database-getters-setters#_getters

Getters always start with the get keyword followed by the camel case version of the field name.

so in your case, you may try getCCreateDate(date){}

hope its help :grinning: