adonis attach

Solutions on MaxInterview for adonis attach by the best coders in the world

showing results for - "adonis attach"
Chiara
23 Mar 2016
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])
Isabel
16 Feb 2020
1const Model = use('Model')
2
3class User extends Model {
4  profile () {
5    return this.hasOne('App/Models/Profile')
6  }
7}
8
9module.exports = User