Contact.js

23 lines | 385 B Blame History Raw Download
'use strict'

/** @type {typeof import('@adonisjs/lucid/src/Lucid/Model')} */
const Model = use('Model')

class Contact extends Model {

  static get computed () {
    return ['fullname']
  }

  organization() {
    return this.belongsTo('App/Models/Organization')
  }

  getFullname ({first_name, last_name}) {
    return `${first_name} ${last_name}`
  }

}

module.exports = Contact