Answer the question
In order to leave comments, you need to log in
How to handle different data at the same url nesting level?
How to be in such cases?
Route::get('/{page}', 'Frontend\[email protected]');
Route::get('/{catalog}', 'Frontend\[email protected]');
Route::get('/{catalog}/{filters?}', 'Frontend\[email protected]');
Route::get('/{catalog}{product}', 'Frontend\[email protected]');
The first solution that comes to mind is to create 1 route for page and catalog, then search the database by url and give different results.
What if there are 10,000 pages? What if there are 3 different types of pages and you need to keep the url at level 1? Etc.
Answer the question
In order to leave comments, you need to log in
Use prefixes:
Route::get('/page-{page}', 'Frontend\[email protected]');
Route::get('/catalog-{catalog}', 'Frontend\[email protected]');
Route::get('/catalog-{catalog}/{filters?}', 'Frontend\[email protected]');
Route::get('/catalog-{catalog}/product-{product}', 'Frontend\[email protected]');
Since the above is only .... everywhere they say that you need to use multiple resource naming but I don’t like it ...
Route::get('/page/{page}', 'Frontend\[email protected]');
Route::get('/catalog/{catalog}', 'Frontend\[email protected]');
Route::get('/catalog/{catalog}/{filters?}', 'Frontend\[email protected]');
Route::get('/catalog/{catalog}/product/{product}', 'Frontend\[email protected]');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question