So I have routing scheme like below.
When URIlooks like "audi-a4-modification-category" - it work's fine.
But when I have uri like "alfa-romeo-giulietta-modification-category",
becouse Laravel thinks alfa - brand, romeo - model ... and I'm getting wrong method from controller. How can I fix that, without changing delimiter in URI?
Route::get('{brand}-{model}-{modification}-{category}', 'Frontend\PagesController@category')->middleware('custom-routing')->name('frontend.category');
Route::get('{brand}-{model}-{modification}', 'Frontend\PagesController@modification')->middleware('custom-routing')->name('frontend.modification');
Route::get('{brand}-{model}', 'Frontend\PagesController@model')->middleware('custom-routing')->name('frontend.model');
Route::get('{brand}', 'Frontend\PagesController@brand')->middleware('custom-routing')->name('frontend.brand');
The laravel docs state the following:
More info: https://laravel.com/docs/5.8/routing#required-parameters
A workaround would be to replace the url parts before generating the url:
The route:
The link:
The controller: