I have route in web.php
Route::get('{cat}',[WebsiteController::class,'dbCategories'])->name('dbCategories');
{cat} is slug of the particular category whose products are to be shown.
I have issue with another route here
Route::get('blogs',[WebsiteController::class,'show_blogs_toWebsite'])->name('show_blogs_toWebsite');
When i hit this route it goes to first one. How can i differentiate these two.
Please help me. thanks.
>Solution :
- You can change first route url by adding a string before or after {cat} like
Route::get(‘/category/{cat}’,[WebsiteController::class,’dbCategories’])->name(‘dbCategories’)
Also , if you will change the ordering of routes , It will be work fine
Note: run php artisan route:clear command before testing