-
-
Save ipiyer/bb3d6fe6bfbdecb07b75 to your computer and use it in GitHub Desktop.
Model methonds
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let User = bookshelf.Model.extend({ | |
tableName: 'user', | |
idAttribute: 'id', | |
hasTimestamps: ["updated_at", "created_at"], | |
socialAccount: function() { | |
return this.hasMany(UserSocialAccount); | |
}, | |
findById: function(id) { | |
return this.where({ | |
id: id | |
}).fetch({ | |
require: true | |
}); | |
}, | |
findOrCreateUser: function(profile) { | |
return utils(this).findOrCreateUser(profile); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment