Laravel Jensseger Mongodb belongsToMany additional fields

302 views Asked by At

the documentation says "The belongsToMany relation will not use a pivot "table", but will push id's to a related_ids attribute instead. This makes the second parameter for the belongsToMany method useless. If you want to define custom keys for your relation, set it to null"

Then how can i set additional fields on related_ids attributes?

I have products and a cart,

here is a subdocument of cart about related_ids

product_id: [ '600ed36d5e2720122c633172', '600ed3e792a0e87c86741eb2', '600ed3f1bc85983ebc06fc53', '600edcdfccfc896fe81fc262', '600edd71bc665d23a03558c2' ],

but i need to set quantity for each product

0

There are 0 answers