Make use of Laravel 5 default login
If you see the default AuthController.php, you can actually see this use AuthenticatesAndRegistersUsers
.
They called this as traits, which was introduced in PHP 5.4.0
By using their default login, you have to create your own view, e.g.
1 | <form class="form-signin" method="POST"> |
In the app/Http/Controllers/Auth/AuthController.php, you can specify your username in the table
(some of people will use email instead). The $redirectPath
is refer to after you successful
login, where should it redirect to?
1 |
|
As my example, I actually move the model class to a Models folder, thus I need to change this
config/auth.php
1 |
|
If you want to change the login error message, originally is “These credentials do not match our records.”
Then you can edit resources/lang/en/auth.php
1 |
|
Basically is done now. Try it yourself…
References: