如何在Laravel中使用cookie保持手动登录系统的登录状态?

时间:2018-11-19 18:54:53

标签: php laravel-5 cookies login

这是我用于登录检查的代码。如何在特定时间内保持cookie值以保持登录状态。

   /*--------------- Check Login -----------------*/
public function checkLogin(Request $request){
    $email=$request->email;
    $password=md5($request->password);
   $remember_me = $request->has('remember_me') ? true : false; 
    $result=DB::table('admins')->where('email_address',$email)->where('password',$password)->where('access_label',3)->where('activation_status',1)->first();

    if($result){
        Session::put('frontend_name', $result->admin_name);
        Session::put('frontend_id', $result->admin_id);
        Session::put('frontend_label',$result->access_label);

        return Redirect::to('/'); 
    }else {
        Session::put('exception', 'Invalid Login Detail...!!!');

        return Redirect::to('frontend-login');
    }
}

0 个答案:

没有答案