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?
淡淡烟草味2017-05-16 16:52:30
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 inUser(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.