Determine if the User Was Authenticated Via the Remember Cookie

Problem

You want to know how the user was authenticated.

You know there's only two possibilities. Either they were already logged into the existing session or they were automatically logged in with the "remember me" cookie.

Solution

Use the Auth::viaRemember() method.

if (Auth::viaRemember())
{
    echo "Aha, you logged in with the remember me cookie.";
}
else
{
    echo "You were already logged in for this request.";
}

Discussion

Nothing to discuss.

comments powered by Disqus