Created
September 12, 2018 07:32
-
-
Save ahmadarif/4d1e6cd6c4eb03e2bcf6e0f04c9b570c to your computer and use it in GitHub Desktop.
Static field Javascript ES6
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
... | |
const User = use('App/Models/User') | |
Route.get('test', () => { | |
return User.METHOD_NAME | |
}) |
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
'use strict' | |
const Model = use('Model') | |
/** | |
* @class App/Models/User | |
* | |
* @property {string} id | |
* @property {string} username | |
* @property {string} email | |
* @property {string} password | |
* @property {string} name | |
* @property {boolean} is_active | |
* @property {datetime} created_at | |
* @property {datetime} updated_at | |
*/ | |
class User extends Model { | |
static get METHOD_NAME() { return 'USER_MODEL' | |
} | |
module.exports = User |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment