If the structure of your user table is different from that of auth that comes with laravel, how can you perform user authentication?
PHP中文网
PHP中文网 2017-05-16 16:50:30
0
1
696

My user table structure is different from the table structure created by user verification in the laravel framework. For example, the default in laravel is to log in through email, but my user table does not have an email field at all. This can also be done through laravel. Is auth used to implement user verification code?

Is it true that if the table structure is different from that in laravel, it cannot be verified using its own auth?

PHP中文网
PHP中文网

认证0级讲师

reply all(1)
淡淡烟草味

Includes the table of the user table (Models/User.php) used for verification,

Verify the read user id field (username/email)

Read password field (password)

Even the verification method (bcrypt) can be customized.

If you are using the 5.1LTS version, you can first read the documentation on the certification chapter

Also take a look at the Traits used by default in your AuthController and UserModel

Trait in

User(Model):Authenticatable

Trait in AuthController(Controller):AuthenticatesAndRegistersUsers(under AuthenticatesUsers)

The middle implementation methods can be customized and overridden in the corresponding Model and Controller. For example, if the username you require is different, you can override the loginUsername method:

/**
 * Get the login username to be used by the controller.
 *
 * @return string
 */
public function loginUsername()
{
    return property_exists($this, 'username') ? $this->username : 'email';
}
Read more documentation and source code.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template