如何让应用程序登录使用用户名或手机号码用户Laravel 5? [英] How to allow application to login user with username or mobile number in Laravel 5?

查看:1984
本文介绍了如何让应用程序登录使用用户名或手机号码用户Laravel 5?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用我Laravel 5应用程序默认的口才认证的驱动程序。我想允许用户与用户名或手机号码登录,以及为那些谁已经进入这两个。 有没有办法把它列入,而无需创建手动验证?

I am using default Eloquent authentication driver in my Laravel 5 application. I want to allow user to login with username or mobile number as well for those who have entered these two. Is there any way to include it without creating manual authentication?

推荐答案

我发现laracasts这个讨论:
<一href=\"https://laracasts.com/discuss/channels/general-discussion/log-in-with-username-or-email-in-laravel-5\" rel=\"nofollow\">https://laracasts.com/discuss/channels/general-discussion/log-in-with-username-or-email-in-laravel-5

I found this discussion on laracasts: https://laracasts.com/discuss/channels/general-discussion/log-in-with-username-or-email-in-laravel-5

它允许用户输入自己的用户名他的电子邮件。 Laravel检查领域,如果它是一个电子邮件或用户名(通过验证它),这取决于它是什么,它​​调用 $ auth-&gt;在尝试()功能正确的字段。

It allows the user to enter his username or his email. Laravel checks the field if it is an email or an username (by validating it) and depending on what it is it calls the $auth->attempt() function with the correct field.

同样的事情应该是适用于您的用户名或移动电话号码-问题。

The same thing should be applicable for your username or mobilenumber-problem.

这篇关于如何让应用程序登录使用用户名或手机号码用户Laravel 5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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