Closed TurningTide closed 3 years ago
How about stopping the compiler and re-starting it. It the error still persists, then share a screenshot of it please
I just tried it and works fine for me. Can you please share a repo that helps reproducing the issue?
Closing since no response from the issue reporter and not actionable as well
export default class AbstractModel extends BaseModel {
@column({ isPrimary: true }) public id: number
@column.dateTime({ autoCreate: true }) public createdAt: DateTime
@column.dateTime({ autoCreate: true, autoUpdate: true }) public updatedAt: DateTime
}
import {column, beforeSave} from "@ioc:Adonis/Lucid/Orm"; import Hash from '@ioc:Adonis/Core/Hash' import AbstractModel from "App/Models/AbstractModel";
export default class User extends AbstractModel{ public static table = 'users';
@column() email:string
@column({serializeAs:null}) password:string
@column({serializeAs:null}) remember_me_token:string
@beforeSave() public static async hashPassword (user: User) { if(user.$dirty.password){ user.password = await Hash.make(user.password); } } }