简体   繁体   中英

Laravel auth middleware not working

I have modularized my Laravel app. Following is the path where my controllers resides. \\app\\Modules\\Admin\\Controllers\\SettingController.php

I am using Laravel default auth module for login. In the SettingController constructor I called $this->middleware('auth'); , but even after I login to the app, it is redirecting to Laravel default home page. I think I am breaking some thing in Laravel's flow.

I have 2 route files. One is Laravel default route and another is custom one I created.

\\app\\Modules\\Admin\\routes.php

Route::group(['namespace' => 'App\Modules\Admin\Controllers'], function () {

  Route::get('admin/settings/stadium-level', 'SettingController@stadiumLevel');

});

you can use this code in your route option to specify your middleware explicitly

Route::group(['middleware' => ['web']], function () {
    //
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM