简体   繁体   English

Laravel:身份验证

[英]Laravel: Authentication

I'm developing a Laravel project and I want to handle authentication by using the standard authentication model of laravel 5.2 I did a artisan command: 我正在开发一个Laravel项目,我想使用laravel 5.2的标准身份验证模型来处理身份验证。我做了一个artisan命令:

php artisan make:auth

But it created a view and to connect I have to write email, but for my need I have to use connection by name. 但是它创建了一个视图并进行连接,我必须写电子邮件,但出于我的需要,我必须按名称使用连接。 在此处输入图片说明

Where can I change this? 我在哪里可以更改?

I cannot find the controller login! 我找不到控制器登录!

Look inside controllers -> Auth -> AuthController.php 往里controllers - > Auth - > AuthController.php

This will take you to the controller of where the authentication happens. 这将带您到进行身份验证的控制器。

Inside of the AuthController class add this protected variable: AuthController类的内部,添加以下受保护的变量:

protected $username = 'name';

Change name to whatever you want to authenticate your user with, this should be the name of the column in your DB. name更改为您想要用来验证用户身份的名称,这应该是数据库中列的名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM