简体   繁体   English

Laravel身份验证中间件不起作用

[英]Laravel auth middleware not working

I have modularized my Laravel app. 我已经将我的Laravel应用模块化。 Following is the path where my controllers resides. 以下是我的控制器所在的路径。 \\app\\Modules\\Admin\\Controllers\\SettingController.php

I am using Laravel default auth module for login. 我正在使用Laravel默认身份验证模块进行登录。 In the SettingController constructor I called $this->middleware('auth'); SettingController构造函数中,我调用了$this->middleware('auth'); SettingController , but even after I login to the app, it is redirecting to Laravel default home page. ,但即使我登录到应用程序后,它仍会重定向到Laravel默认主页。 I think I am breaking some thing in Laravel's flow. 我想我正在打破Laravel的流程。

I have 2 route files. 我有2个路由文件。 One is Laravel default route and another is custom one I created. 一个是Laravel默认路线,另一个是我创建的自定义路线。

\\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选项中使用此代码来明确指定中间件

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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