Laravel - Authentication - Remembering Users
Many web applications provide a "remember me" checkbox on their login form. If you would like to provide "remember me" functionality in your application, you may pass a boolean value as the second argument to the attempt
method.
When this value is true
, Laravel will keep the user authenticated indefinitely or until they manually logout. Your users
table must include the string remember_token
column, which will be used to store the "remember me" token. The users
table migration included with new Laravel applications already includes this column:
use Illuminate\Support\Facades\Auth;
if (Auth::attempt(['email' => $email, 'password' => $password], $remember)) {
// The user is being remembered...
}