Reputation: 1
Hello Everyone I am posting this question because I don't find this anywhere so please try to provide solution for this problem.
Route::get('/product/{Cat_Slug}/{slug}','ProductController@SingleProductShow')>name('SingleProduct.Show');
This is my route and i want to remove 'product' from url and make my url like. www.example.com/productCat_Slug/ProductSubCat_Slug and want to access all related products but when i do this other routes effected.
Upvotes: 0
Views: 64
Reputation:
Make sure your other routes (those affected by your changes) come before this route in routes/web.php
, so they are "hit" first.
Route::get('/test', 'TestController@test');
Route::get('/{user}', 'TestController@user');
instead of
Route::get('/{user}', 'TestController@user');
Route::get('/test', 'TestController@test');
Upvotes: 1
Reputation: 136
Try this
Route::get('/{Cat_Slug}/{Subcat_slug}','ProductController@SingleProductShow')->name('SingleProduct.Show');
After that you will be able to access the values contained in Cat_Slug and Catsub_slug in your controller and make the query you want.
You also have a syntax error close to the route name. use ->name('myRouteName')
instead of >name('myRouteName')
Upvotes: 0