Setup Menus in Admin Panel

  • No products in the cart.


Laravel Authentication

Laravel makes implementing authentication very simple. Almost everything is configured for you out of the box. The authentication configuration file is located at config/auth.php, which contains several well documented options for tweaking the behavior of the authentication services.

Run the following command:

php artisan make:auth



Check the status :

git status



Now run the following url:


By default you will see the following screenshot:


Screenshot :





But we don’t need this type of form. So, we need to do some customization.

In the web.php file, we have seen only Auth::routes()
By default, it makes the bundle for login, register and forgot password.
So in order to check you have to run the following command:

php artisan route:list

It will display all the routes as below:





Search the showLoginForm

Step 1.

Go to this directory:



Step 2.

Here you will find this step:

use AuthenticatesUsers;

So, search AuthenticatesUsers.php directory

AuthenticatesUsers.php directory:


In this directory you will find the following code:

public function showLoginForm()
return view('auth.login');

Step 3.

Go to the directory resources/views/auth/login.blade.php
Here we are not allowed to change the laravel default package but you can overwrite and copy the function and add it to the LoginController.php (Directory:App\Http\Controllers\Auth\LoginController.php).

* Show the application's login form.
* @return \Illuminate\Http\Response
public function showLoginForm()
return view('auth.login');



Give the path for costumize login.blade.php in the above code.

return view('admin.auth.login')

Screenshot  before modification:


Screenshot after modification:


Create a auth directory inside resources/views/admin/..
and create login.blade.php file inside auth directory.

Copy the code of your login page and paste it to the login.blade.php.
This file is in resources/views/admin/login.blade.php directory.

If you run the url http://newsportal.test/login  you will see the following result:




So you need to give the dynamic path for css and js.


Remove the unnecessary link :
such as forget password, and I want to register.

Simply adding BKP in function showLoginForm() you will redirected to the laravel default login form:

public function showLoginFormBKP()
return view('admin.auth.login');


Here you need to notice the working mechanism of the login form.

1. Open login form and right click the mouse and select Inspect. Now hover the mouse over the form you will see the following result:




So go to App\Http\Controllers\Auth\[email protected] directory


In this directory vendor/laravel/framework/src/illuminate/Foundation/Auth/AuthenticatesUsers.php you can get the login:


Now replace the login form code:


<form method="POST" action="{{ route('login') }}" aria-label="{{ __('Login') }}">




So instead of <form> copy the above code.
Then copy and paste @csrf which is below the form.


Cross-Site Request Forgery (CSRF):

It is an attack that forces an end user to execute unwanted actions on a web application in which they’re currently authenticated. CSRF attacks specifically target state-changing requests, not theft of data, since the attacker has no way to see the response to the forged request.

After using the @csrf you will see the following result:



And make some modification in input filed:

<input type="email" name="email" class="form-control" placeholder="Username" />

<input type="password" name="password"class="form-control" placeholder="Password" />

<input type="checkbox" name="remember" class="ace" />

<button type="submit" class="width-35 pull-right btn btn-sm btn-primary">




Go to the url: http://newsportal.test/login

Valid case:
Enter the email id and password which you have already created

email [email protected]

You will be redirected to the login and homepage.


Screenshot:login page


Screenshot:home page


Invalid case:

First copy the code error case code from resources/views/auth/login.blade.php

@if ($errors->has('email'))
<span class="invalid-feedback" role="alert">
<strong>{{ $errors->first('email') }}</strong>


Paste this above code in the  directory resources/views/admin/auth/login.blade.php below the <span>





If you wish to change the error message color then you can change by adding the class name as an error.


and add some style to class error below the head section:

.error {
color: rgba(132, 19, 41, 0.7);




SEE ALL Add a note
Add your Comment

Advanced Course Search Widget

Popular Courses

Course Categories

© PHPhelp. 2002 - 2018 All rights reserved.