Support the ongoing development of →
posted 6 years ago
Last updated 7 months ago.

It's probably one-to-many relationship, as 1 user can have many articles, posts, and comments. But an article or comment will belong only to 1 user. This may be the structure of your db:

users: id | username | password | ...
articles: id | user_id | title | body | ...
comments: id | user_id | article_id | body | ...

Just like user, an article may have one-to-many relationship with comments. An article has many comments but a comment belongs to only one article posted by one user.

Last updated 6 years ago.

Sign in to participate in this thread!

Full Stack Europe

Your banner here too?

shigg1120 shigg1120 Joined 16 Dec 2015


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 - All rights reserved.