dimanche 5 avril 2020

Create dynamic routes in Laravel

I'm working on ecommerce website, Stuck in nav bar, I have created routes something like this:

Route::get('/category/{slug}', 'Site\CategoryController@show')->name('category.show');

In slug i pass slug of Product,

but i want to change something like this

 Route::get('/{slug}/{slug}', 'Site\CategoryController@show')->name('category.show');

i want to remove category prefix and pass main category slug as a first parameter and sub category if it exist as a second parameter otherwise it will be empty.

One more thing i am using TypiCMS, for creating Nestable menu and it is working will i have to modify that also to work with the dynamic route.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire