Answer the question
In order to leave comments, you need to log in
How to organize dynamic routing?
Hello!
Pages and their content are in the database,
How can I organize dynamic routing with nesting (namely from the root of the site)?
those. if the page has parents, then they were available via nested links.
Now this is implemented clumsily:
Route::get('/{page_section_1}/{page_section_2?}', '[email protected]');
Answer the question
In order to leave comments, you need to log in
You can set one variable into which the whole path will fall (or a part after a certain path), and then in the controller break it by "/" and work like nested pages:
Route::get('/test/{path}', function($path) {
echo $path; // разбиваем, обрабатываем
})
->where('path', '.*?'); // в path упадут совершенно все символы после /test/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question