const user = await User.find(1) const project = await Project.find(1) await user.related('projects').attach([project.id]) // or await user.related('projects').attach({ [project.id]: { role: 'admin' } })