2020-04-14 00:56:04 +00:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
/** @type {typeof import('@adonisjs/lucid/src/Lucid/Model')} */
|
|
|
|
const Model = use('Model')
|
|
|
|
|
|
|
|
class Book extends Model {
|
2020-04-29 23:45:50 +00:00
|
|
|
static get hidden() {
|
|
|
|
return ['user_id'];
|
|
|
|
}
|
2020-04-14 00:56:04 +00:00
|
|
|
user() {
|
2020-04-28 03:04:09 +00:00
|
|
|
if (!this.user_id) return null;
|
2020-04-14 00:56:04 +00:00
|
|
|
return this.belongsTo('App/Models/User');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Book
|