1.配置资源路由
对某个模型和控制器配置七个资源路由
Route::get('issues', 'IssuesController@index')->name('issues.index');
Route::post('issues', 'IssuesController@store')->name('issues.store');
Route::get('issues/create', 'IssuesController@create')->name('issues.create');
Route::get('issues/{issue}', 'IssuesController@show')->name('issues.show');
Route::put('issues/{issue}', 'IssuesController@update')->name('issues.update');
Route::delete('issues/{issue}', 'IssuesController@destroy')->name('issues.destroy');
Route::get('issues/{issue}/edit', 'IssuesController@edit')->name('issues.edit');
一行代码配置七个资源路由,和上面代码效果一样
Route::resource('issues', 'IssuesController');
2.普通路由的配置
某个页面与某个控制的关联
Route::get('about', 'WelcomeController@about');
3.根路由的配置
Route::get('/', 'WelcomeController@index');
4.可选资源路由
Route::resource('comments', 'CommentsController', ['only' => ['store']]);
5.参看路由列表
$ php artisan route:list
网友评论