This is My Route
Route::namespace("Core\Controller\Site")
->prefix("/")
->name("site.")
->group(function () {
Route::get("{slug}", "NewsController@index")->name("news.index");
Route::get("show/{slug}", "NewsController@show")->name("news.show");
Route::get("{slug}", "ArticleController@index")->name("article.index");
Route::get("show/{slug}", "ArticleController@show")->name("article.show");
Route::get("{slug}", "VideoController@index")->name("video.index");
});
This is My a href which is I used This Route
<a href="{{ route('site.news.show', $item->slug) }}"></a>
It gives Such Kind Of Error
Route [site.news.show] not defined.
CodePudding user response:
You are using the same route paths (show/{slug} and {slug})
with the same methods for different route names.
I think they override each other. Try to use different route paths.
CodePudding user response:
change the name of the route and it will work.
show_news and show_article
Route::namespace("Core\Controller\Site")
->prefix("/")
->name("site.")
->group(function () {
Route::get("{slug}", "NewsController@index")->name("news.index");
Route::get("show_news/{slug}", "NewsController@show")->name("news.show");
Route::get("{slug}", "ArticleController@index")->name("article.index");
Route::get("show_article/{slug}", "ArticleController@show")->name("article.show");
Route::get("{slug}", "VideoController@index")->name("video.index");
});