Skip to content

Instantly share code, notes, and snippets.

@ahmadarif
Created September 12, 2018 07:32
Show Gist options
  • Save ahmadarif/4d1e6cd6c4eb03e2bcf6e0f04c9b570c to your computer and use it in GitHub Desktop.
Save ahmadarif/4d1e6cd6c4eb03e2bcf6e0f04c9b570c to your computer and use it in GitHub Desktop.
Static field Javascript ES6
...
const User = use('App/Models/User')
Route.get('test', () => {
return User.METHOD_NAME
})
'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