Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
333 views
in Technique[技术] by (71.8m points)

Laravel Jensseger Mongodb belongsToMany additional fields

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

question from:https://stackoverflow.com/questions/65887379/laravel-jensseger-mongodb-belongstomany-additional-fields

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...