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
2
3
4
5
6
<form class="form-signin" method="POST">
{!! csrf_field() !!}
<input type="text" name="username" class="form-control" placeholder="Username">
<input type="password" name="password" class="form-control" placeholder="Password">
<button class="btn btn-lg btn-primary" type="submit">Sign in</button>
</form>

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
2
3
4
5
6
7
8
9
<?php
// ...
use App\Models\User;
// ...
protected $redirectPath = '/dashboard';
protected $username = 'username';

As my example, I actually move the model class to a Models folder, thus I need to change this

config/auth.php

1
2
3
<?php
//
'model' => App\Models\User::class, // <------- change this

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
2
3
<?php
// ...
'failed' => 'Your custom error message',

Basically is done now. Try it yourself...

References: