📜  adonisjs 钩子 - TypeScript 代码示例

📅  最后修改于: 2022-03-11 14:48:17.959000             🧑  作者: Mango

代码示例1
@beforeSave()
public static async hashPassword (user: User) {
  if (user.$dirty.password) {
    user.password = await Hash.make(user.password)
  }
}