Laravel, categories and subcategories

Posted 3 years ago by Kitephx

Hello, For beginning, I have a table that contains post nouveautes then the categories and sub categories.

For example, a number of sub categories able to have several categories and sub categories be able to have multiple categories.

(literature*) -> Reviews -> Folder -> Chronic

(Cinema*) -> Reviews -> Folder -> Chronic

(music*) -> Reviews -> Folder -> Chronic

  • = Categories

I want a post belong to categories and sub categories.

I thought to make a many to many between categories and sub categories and then put a category_id subcategory_id in the post table.

Is this correct and / or optimized?

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

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.