1
環回模式鉤內使用模型實例,我知道你可以訪問如User模型的實例是通過使用beforeCreate創建之前:SLC回送:從模型鉤
User.beforeCreate = function(next, userInstance) {
//your logic goes here using userInstance
next();
};
但如果我需要添加一些使用剛剛創建的用戶的firstName的應用程序邏輯,我該怎麼做?
User.afterCreate = function(next) {
//I need access to the user that was just created and some of it's properties
next();
};
有沒有辦法讓剛剛創建或者我需要改變使用我的應用程序邏輯,而不是之前和之後用戶的持有?