Answer the question
In order to leave comments, you need to log in
Why does routes confuse controllers?
Good evening. Please tell me what could be wrong.
There is a route
Route::get('{slug}', '[email protected]')->name('post');
and
Route::get('karta-sajta', '[email protected]')->name('sitemap');
If I go to the address: https://site.ru/karta-sajta , then an error pops up, because not the SitemapController is triggered, but the BlogController. Although, in theory, the SitemapController should work
Answer the question
In order to leave comments, you need to log in
Change the order of the routes, and then read the documentation and think.
Put in this order
Route::get('karta-sajta', '[email protected]')->name('sitemap');
Route::get('{slug}', '[email protected]')->name('post');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question