Usage
In order to use the default login capabilities (“login via e-mail, phone number, or username”):
-
Add the
Contactable
trait to your User model:use Contactable;
-
Set the authentication driver by changing
driver
underconfig/auth
:'driver' => 'contactable',
Using Default Laravel 5.1 Authentication
If you are using Laravel’s included authentication (via the documentation), installing Contactable for logins is a breeze.
-
At to the top of your
AuthController
, add:protected $username = 'username';
-
Edit your
<input>
’s name inlogin.blade.php
to username instead of email.
That’s it! You will need to code your own registration and validation (default implementations are in
AuthController
, functions validator
and create
).