Laravel Auth ::后卫(后卫) - > check()没有按预期工作

I am making a homework web app using Laravel and I am trying to add 3 different groups of people: admins, teachers and students. I have created all of these as models and they all have tables in the database. The login script works and logs the user in however the problem occurs when I use this code

    if(Auth::guard('student')->check() || Auth::guard('teacher')->check() || Auth::guard('admin')->check()) {
        return Redirect::to('/admin/overview')->send();
    }

The login works because when I enter a correct username and password I get redirected away but when I use an incorrect username and password I get redirected to the same page.

My problem is that line of code doesn't do anything it seems that Auth::guard('student')->check() always returns false. Which is weird because this:

    if(Auth::guard('student')->attempt($credentials)) {
        return Redirect::to('/student/overview')->send();
    }

returns true and redirects me to /student/overview

I faced the same issue then I tried first create the instance of Auth and then use check()

You need to manage this way just try this hope it helps you

$auth = Auth::guard('student');
if ($auth->check()) {
    return Redirect::to('/admin/overview')->send();
}