Attach working, detach not working



I’ve created a couple of endpoints to attach/detach rows on a pivot table. Attach is working fine but Detach is not.

For example; This code works

	let order = await Order.find( params.order_id )
	order.tags().attach( [ params.tag_id ] )

This code does not work

	let order = await Order.find( params.order_id )
	order.tags().detach( [ params.tag_id ] )

Having peeked at the code the value of this._existingPivotInstances appears to be empty but I am not sure I am understanding it correctly.

Can anybody please advise? Is it a silly mistake on my behalf?

Many thanks.


You have to await attach and detach function calls


Doh! Thanks @virk, silly mistake.