简体   繁体   中英

Laravel does not redirect to login page when I try to access to home page

I try writting the url http://127.0.0.1:8000/home and I'm not logged in and it shows me home page but obviously not loaded correctly, What I want is when I write http://127.0.0.1:8000/home to redirect me to http://127.0.0.1:8000/login page I know this works in fresh projects with make:auth module, I don't know why stopped workin.

In my home I have this

 public function __construct()
    {
        $this->middleware('auth');
    }

and my routes file:

Route::get('/', function () {
    return view('auth\login');
});

Auth::routes();


Route::post('create','IngresarSolicitud@store');
Route::get('/home','IngresarSolicitud@informacionempleado');

I added ->middleware('auth'); at the end of my routes to redirect to login in this case, thanks

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