2

i'm creating a web application for my client and the concept of this application is two user register in system and they can have deal with each other, for example i register in system, then you register then we can have dealing with each other and transfer money, but i'm wondering what is the right Relationship for this application? every user can have multiple dealing and every dealing has two user, so in here every row of database is a deal that connect to two user.

this is a one to many (one: deal, many: user) or Many to Many Relationship?

1 Answers1

0

Many to many will be a better choice if you don't need Deal model and you are not going to work with deals data a lot. But if you are, you should create a Deal model and use one to many relationships. Or you could even use both many to many and one to many at the same time. In this case, deals table will be a pivot table and it will have a model.

Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279
  • Thank you for your answer, the Deal Model data is static, they Are registered for one time and don't change in the future. do you think is better to have a Deal model that is in rel (Many to Many) with user table? – Hamid Adibzadeh Jan 06 '18 at 08:23