laravel 中路由的快速设置(只需一个控制器名就ok) 不用具体到方法

routes/web.php 设置路由

Route::group(['middleware' => ['\iqiyi\Http\Middleware\VerifyCsrfToken::class']], function () {
//支付订单
Route::any('order/{action}', function(\iqiyi\Http\Controllers\Order $index, $action,\Illuminate\Http\Request $request ){ return $index->$action($request);
})->middleware('authAdmin'); // 报告
Route::any('report/{action}', function(\iqiyi\Http\Controllers\Report $index, $action,\Illuminate\Http\Request $request ){ return $index->$action($request);
})->middleware('authAdmin'); // 数据统计
Route::any('statistics/{action}', function(\iqiyi\Http\Controllers\Statistics $index, $action,\Illuminate\Http\Request $request ){
return $index->$action($request);
})->middleware('authAdmin');
// 图片管理
Route::any('img/{action}', function(\iqiyi\Http\Controllers\Img $index, $action,\Illuminate\Http\Request $request ){ return $index->$action($request);
//dump($request);
})->middleware('authAdmin');
// 用户管理
Route::any('user/{action}', function(\iqiyi\Http\Controllers\User $index, $action,\Illuminate\Http\Request $request ){ return $index->$action($request);
})->middleware('authAdmin');
// 角色管理
Route::any('role/{action}', function(\iqiyi\Http\Controllers\Role $index, $action,\Illuminate\Http\Request $request ){ return $index->$action($request);
})->middleware('authAdmin');
// 菜单管理
Route::any('menu/{action}', function(\iqiyi\Http\Controllers\Menu $index, $action,\Illuminate\Http\Request $request ){ return $index->$action($request);
})->middleware('authAdmin'); Route::any('/login', 'Login@index');
Route::any('logout', 'Login@logout'); Route::any('/', 'Index@main')->middleware('authAdmin'); Route::any('import', 'Import@index')->middleware('authAdmin'); Route::any('import/{action}',function(\iqiyi\Http\Controllers\Import $index, $action,\Illuminate\Http\Request $request ){
return $index->$action($request);
})->middleware('authAdmin'); Route::any('stock/{action}',function(\iqiyi\Http\Controllers\Stock $index, $action,\Illuminate\Http\Request $request ){
return $index->$action($request);
})->middleware('authAdmin'); Route::get('downreport/{filename}/{expname}', function($filename,$expname) {
return response()->download(storage_path('report/'.$filename),$expname.'.xls');
})->middleware('authAdmin'); // Route::any('channel/{action}',function(\iqiyi\Http\Controllers\Channel $index, $action,\Illuminate\Http\Request $request ){
// return $index->$action($request);
// })->middleware('authAdmin');
Route::any('importlist', 'Import@lists')->middleware('authAdmin'); });
Route::any('order/{action}', function(\iqiyi\Http\Controllers\Order $index, $action,\Illuminate\Http\Request $request ){

        return $index->$action($request);
})->middleware('authAdmin');
上一篇:WSASocket()创建套接字不成功解决方法


下一篇:一个基于STSdb和fastJson的磁盘/内存缓存