laravel-5.2 – Laravel 5.2:Web中间件应用了两次

前端之家收集整理的这篇文章主要介绍了laravel-5.2 – Laravel 5.2:Web中间件应用了两次前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
这是我的routes.PHP代码
Route::auth();

    Route::group(['middleware' => 'web'],function () {
Route::group(['namespace' => 'Admin','prefix' => 'admin','middleware' => ['auth','role:Admin']],function(){

    Route::get('/home','HomeController@index');

    Route::get('user/data',['as' => 'admin.user.data','uses'=>'UserController@userData']);
    Route::resource('user','UserController');

    Route::get('merchant/data',['as' => 'admin.merchant.data','uses'=>'MerchantController@merchantData']);
    Route::resource('merchant','MerchantController');

    Route::get('bcategory/data',['as' => 'admin.bcategory.data','uses'=>'BusinessCategoryController@bcategoyData']);
    Route::resource('bcategory','BusinessCategoryController');

    Route::get('ccategory/data',['as' => 'admin.ccategory.data','uses'=>'CouponCategoryController@ccategoyData']);
    Route::resource('ccategory','CouponCategoryController');

    Route::delete('image/{image}',['as' => 'admin.image.destroy','uses'=>'ImageController@destroy']);

    Route::put('image/{image}/primary',['as' => 'admin.image.updateprimary','uses'=>'ImageController@setPrimaryImage']);
});

Route::group(['namespace' => 'Merchant','prefix' => 'merchant','middleware' => 'role:Merchant'],function(){

 });
});

任何人都可以告诉我为什么Web路由应用两次我只添加一次组中间件.

解决方法

进行更改以始终在RouteServiceProvider中调用Web中间件,因此无需在routes.PHP中指定它.

更新Documentation说:

请记住,Web中间件组由RouteServiceProvider自动应用于您的默认routes.PHP文件.

原文链接:https://www.f2er.com/html/231969.html

猜你在找的HTML相关文章