我的路线有问题,我有我的路线:
Route::get('dashboard/password', 'UserController@password');
Route::post('dashboard/updatepassword', 'UserController@updatePassword');
// PAGINA UTENTE PUBBLICA
Route::get('/{username}', 'FrontController@user');
// blog routes
Route::get('blog', 'FrontController@blog');
Route::get('blog/{slug}', 'FrontController@article');
Route::get('blog/category/{name}', 'FrontController@BlogCategory');
Route::get('blog/tag/{name}', 'FrontController@tags');
Route::resource('comment', 'CommentController');
和我的 FrontController:
public function blog()
{
$articles = Article::OrderBy('id','DESC')->paginate(3);
$Allarticles = Article::OrderBy('id','DESC')->get();
$Allcategories = BlogCategory::OrderBy('id','DESC')->get();
$Alltags = Tag::OrderBy('id','DESC')->get();
$Allcomments = Comment::OrderBy('id','DESC')->take(3)->get();
return view('blog', compact('articles','Alltags','Allarticles','Allcategories','Allcomments'));
}
如果我去“http://localhost:8000/博客 http://localhost:8000/blog“它返回到我之前所在的页面。类似于route->back()。
我不知道为什么我有这个问题,其他博客路线运行良好。
我做了一些这样的测试:
public function blog()
{
return "Hi";
}
它不会返回“Hi”,所以我认为路线有问题。我没有在这里启用中间件,我的其他路线(例如博客/文章)运行良好。