This is my use case.
If I do
Audits.belongsTo(User)
User model's primary key will be added to the Audits model as the foreign key.
But that foreign key value will be repeated since User has many Audits .
For that reason do I need to add some relationship to the User model?
But that foreign key value will be repeated since User has many Audits.
That is how it should work , There is nothing wrong in it , that's the standard way of RDBMS.
Audits.belongsTo(User)
So go ahead.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.