Like you have created a pivot table for category and pages you can also create it for post and pages
Apr 7, 2020
1
Level 1
belogs to many Relation between 3 tables
I have 3 entities Category,Post and Page. the relation between Category and Post is belongs to many ( and it works fine) and the relation between Page and Category is also belongs to many (it works fine too). now i want to retrieve all categories' posts in a page .Is there a way to make a directly relation between Page and Post? my tables structure :
categories:
int id
string title
posts:
int id
text content
categories_posts:
int id
int category_id
int post_id
pages:
int id
string title
pages_categories:
int id
int page_id
int category_id
Please or to participate in this conversation.