猿问

未定义路由 [blog.all_article]

我想从 到 ,但他们告诉我找不到这样的路线。我做错了什么。提前感谢您的帮助。home.blade.phpall_article.blade.php


博客/首页刀片


 <a href="{{route('blog.all_article')}}" class="btn btn-primary pull-right"><i class="fa fa-plus-square-o"></i> Add</a> 

博客控制器


public function articlesAll_blade(){

   return view('blog.all_article',[

     'articles' => Article::orderBy('created_at', 'desc')->paginate(10),

      'footers' => System::all(),

   ]);

}

网站.php


 Route::get('/', 'BlogController@articlesAll', function () {

     return view('blog.home');

 });


 Route::get('/all_article', 'BlogController@articlesAll_blade', function () {

     return view('blog.all_article');

 }); 


子衿沉夜
浏览 68回答 2
2回答

慕容708150

您缺少的是路由名称,为您的路由添加名称Route::get('/all_article',&nbsp;'BlogController@articlesAll_blade',&nbsp;function&nbsp;()&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;view('blog.all_article'); &nbsp;})->name('blog.all_article');//&nbsp;see&nbsp;the&nbsp;name&nbsp;part文档链接&nbsp;https://laravel.com/docs/routing#named-routes

一只萌萌小番薯

Route::get('/all_article','BlogController@articlesAll_blade')->name('blog.all_article');
随时随地看视频慕课网APP
我要回答