How to make a dynamic category tree in the route?

Posted 2 months ago by alex_storm

Hello! Thank you for paying attention to my question. I want to create dynamic routes for categories and products.

For example: category-1/category-2/category-3/category-4/product-1.html

I can have a big nesting up to 10 categories. I created a property in the database that defines the main category and I store a category link tree in a separate table.

I add the product only one main category.

I cannot understand how I can create the correct route in Laravel so that it can handle this nesting.

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

Reply to

Use Markdown with GitHub-flavored code blocks.