I
I
itpeople2019-05-27 17:45:37
Laravel
itpeople, 2019-05-27 17:45:37

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

2 answer(s)
J
JhaoDa, 2019-05-27
@JhaoDa

Change the order of the routes, and then read the documentation and think.

A
adam_carraway, 2019-05-27
@adam_carraway

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 question

Ask a Question

731 491 924 answers to any question