3、一个路由实现多种请求
1、match
Route::match(['get','post'],'/',"IndexController@index");
2、any
Route::any(’/’,“IndexController@index”);
4、资源路由
1、实例
后台拥有很多模块,用户模块、管理模块等(增、删、改、查)
Route::get('user/index','UserController@index');
Route::get('user/add','UserController@add');
Route::get('user/edit','UserController@edit');
Route::post('user/insert','UserController@insert');
Route::post('user/update','UserController@update');
Route::get('user/del','UserController@del');
2、资源路由
Route::resource('Admin','IndexController');
| GET|HEAD | Admin | Admin.index | App\Http\Controllers\IndexController@index | web
| #展示页面
| POST | Admin | Admin.store | App\Http\Controllers\IndexController@store | web
| #添加操作
| GET|HEAD | Admin/create | Admin.create | App\Http\Controllers\IndexController@create | web
| #添加页面
| DELETE | Admin/{Admin} | Admin.destroy | App\Http\Controllers\IndexController@destroy | web
| #删除操作
| PUT|PATCH | Admin/{Admin} | Admin.update |
App\Http\Controllers\IndexController@update | web | #更新操作
| GET|HEAD | Admin/{Admin} | Admin.show | App\Http\Controllers\IndexController@show | web
|
| GET|HEAD | Admin/{Admin}/edit | Admin.edit | App\Http\Controllers\IndexController@edit | web
| #修改页面
| GET|HEAD | api/user | | Closure | api,auth:api |