Crochets Adonisjs

@beforeSave()
public static async hashPassword (user: User) {
  if (user.$dirty.password) {
    user.password = await Hash.make(user.password)
  }
}
GutoTrosla