How to Setup Laravel Login Authentication in Simple and Easy Steps

by Noor Ali  September 1, 2016

In this tutorial, I will discuss how to implement Laravel login authentication. An important feature of this authentication implementation is that it filters out and generates an error whenever the authentication credentials (for example, email and/or password) are incorrectly entered by the user(s).



  1. Cloudways Server. Get your server on Cloudways if you do not have one.
  2. Launch a Laravel 5.2 app.

Step 1: Setup the Database

  • Go to your Laravel application on the Cloudways server.
  • Click on Launch Database.
  • Click on Create Table. Name the new table users and select innoDB and ascii_general
  • Add the following columns in the table:
    • id (int)   (Check AutoIncrement A.I.)
    • name (text)
    • username (text)
    • email (text)
    • password (text)
    • remember_token (text)
    • timestamp (time)
  • Click Save
  • Now Click New Item and then add the following user:
    • Name: Harry Potter
    • Username: BoyWhoLived
    • Email:
    • Password: caputdraconis
  • Click Save

Step 2: Setup the Routes

Here lies all the endpoints.

Let’s make three endpoints:

  1. Post Call to submit the form
  2. Get Call to show the login form
  3. To LogOut.

Step 3: Make the Controllers

I will extend MainController from the Base Controller and make three functions to show login, check the login and for logging out.

Following is the code for MainController:

Step 4: Setup the View

Now let’s make the view, which will contain the HTML code of the app.

The .blade.php extension lets Laravel know that I am using its Blade Templating system.


Here is the HTML code for this file.

Now let’s check how the app looks!

Laravel Login

This is a simple example of how you could implement login authentication in a Laravel app. If you have a question about this implementation or wish to add to the conversation, please leave a comment below.


Create Laravel apps without the worry of server management.

Deploy your app on optimized PHP hosting servers for Laravel.

About Noor Ali

Noor Ali is an Associate Software Engineer at Cloudways. He loves to solve technical problems through programming and mathematics.

Stay Connected:

You Might Also Like...

  • Tiep Pt

    why so hard?
    Just: php artisan make:auth