Laravel 4:如何在使用Auth :: login登录时记住用户 [英] Laravel 4: how to remember a user when logging him in using Auth::login

查看:356
本文介绍了Laravel 4:如何在使用Auth :: login登录时记住用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的用户可以使用社交选项(Facebook,Twitter)登录,因此我不使用Auth::attempt()方法,而是使用Auth::login().

My users can login using social options (Facebook, Twitter) and so I don't use the Auth::attempt() method, but the Auth::login().

我该如何记住我的用户,以便他们不必在每次重新启动浏览器时都登录?

How can I remember my users so the don't have to login every time they restart the browser?

推荐答案

它不在文档中,但是如果您查看代码;

It is not in the docs, but if you look at the code;

public function login(UserInterface $user, $remember = false)

所以就做

Auth::login($user, true);

这篇关于Laravel 4:如何在使用Auth :: login登录时记住用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆