francois
2266
13
Requests

Many to Many relation with unique records in pivot

Posted 4 years ago by francois

Hi, When you use attach() method in a many to many relation, you can add this record multiple times.

Here is an example of the pivot table

id, model1, model2

1, 10, 11

2, 10, 11

And, I'd like to forbidden this behavior.

Sync() method can't be used in my case. Thanks.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.