laravel remember me not working

时间秒杀一切 提交于 2019-12-09 07:00:02

问题


I have created 2 different login forms for admin and users in admin login form i have used attempt function i want to use remember me functionality but when i log in to the system without clicking remember me checkbox i can see in database it stores some value is it normal that its storing values not checking remember me token ? this is my code for admin login

 if (Auth::guard('admin')->attempt(['email' => $request->email, 'password' => $request->password], $request->remember)) {
    // if successful, then redirect to their intended location
    return redirect()->intended(route('admin.dashboard'));
  }

can someone please help me with remember me functionality in laravel


回答1:


Try passing boolean value as second parameter to method attempt , or

if (Auth::viaRemember()) {
   //
}

use viaRemember in new laravel versions

also , check your config/session.php setting

'lifetime' => 10080,
'expire_on_close' => true,

just set your expire_on_close to true and Auth with Auth::viaRemember()

hope this is helpful



来源:https://stackoverflow.com/questions/49232912/laravel-remember-me-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!