1const User = use('App/Models/User')
2const Car = use('App/Models/Car')
3
4const mercedes = await Car.findBy('reg_no', '39020103')
5const user = await User.find(1)
6
7await user.cars().attach([mercedes.id])
1const Model = use('Model')
2
3class User extends Model {
4 profile () {
5 return this.hasOne('App/Models/Profile')
6 }
7}
8
9module.exports = User