Home > Backend Development > PHP Tutorial > Laravel 5.1 login using username

Laravel 5.1 login using username

WBOY
Release: 2016-07-23 08:54:46
Original
995 people have browsed it

If you do some research on laravel login, you can find this code

  1. public function loginUsername()
  2. {
  3. return property_exists($this, 'username') ? $this->username : 'email';
  4. }
Copy the code

Here we make a judgment whether the attribute username exists. There is no way to use email.

So if you want to log in with a username, just change AuthController.php and add a username attribute.

  1. protected $username = 'name';
Copy code

view

  • Copy code

    Original text: http://note.mango.im/article/26

    Laravel


    source:php.cn
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template