当我尝试访问主页时,Laravel不会重定向到登录页面

时间:2020-02-06 18:20:03

标签: php laravel authentication web laravel-middleware

我尝试写URL http://127.0.0.1:8000/home,但没有登录,但它显示了我的主页,但显然未正确加载,我要写的是写http://127.0.0.1:8000/home时将我重定向到{{ 3}}页面,我知道这可以在带有make:auth模块的新项目中使用,我不知道为什么停止工作。

我家里有这个

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

和我的路线文件:

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

Auth::routes();


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

1 个答案:

答案 0 :(得分:0)

我添加了-> middleware('auth');在这种情况下,在我的路线末端重定向到登录名,谢谢