Answer the question
In order to leave comments, you need to log in
How to build a URL from multiple subcategories?
Dear programmers!
Please explain how to competently build a URL from many subcategories?
I have a page - all categories (general menu).
// роут
Route::get('/category', '[email protected]')->name('category.index');
// контроллер
public function index()
// роут
Route::get('/category/{alias?}', '[email protected]')->name('category.one');
// контроллер
public function one($alias, Request $request)
// через ссылку
<a title="{{ $v['name'] }}" href="{{ route('category.one', $v['url']) }}">
Answer the question
In order to leave comments, you need to log in
Route::get('/category/{alias?}', '[email protected]')->where('alias', '(.*)')->name('category.one');
There is an option, use the where method and write a regular expression there, if you understand the problem correctly
https://laravel.com/docs/8.x/routing#parameters-re...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question