seepur/app/Models/Book.js

16 lines
307 B
JavaScript

'use strict'
/** @type {typeof import('@adonisjs/lucid/src/Lucid/Model')} */
const Model = use('Model')
class Book extends Model {
static get hidden() {
return ['user_id'];
}
user() {
if (!this.user_id) return null;
return this.belongsTo('App/Models/User');
}
}
module.exports = Book