L
L
lolrofl012021-03-13 18:47:09
Laravel
lolrofl01, 2021-03-13 18:47:09

How to set a route in laravel if the number of options is unknown?

Good afternoon.
There are an unlimited number of categories. If the post is placed in a child category, then the address should be of the form: site.ru/parent_category/....children.../that_child_in_which_post/post

As you understand, these "....children...." can be unlimited amount. According to the TK, there are only 3 levels, but we know that :)

So how to make such a route? Thanks to.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Antonio Solo, 2021-03-14
@lolrofl01

I explicitly formed the route /a/b/c/ for "post" and wrote it to the database.
then all "incomprehensible" URLs were simply checked by database

A
Alexander Medvedev, 2021-03-14
@lifestar

This is how it turns out: you write a specific technical specification, but the performer "knows something" and instead of the required one tries to cut some kind of universal solution that does not even know how to solve it.
Do it according to TK

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question