Laravel 5.8 User Registration And Login System

In this tutorial you will learn about the Laravel 5.8 User Registration And Login System and its application with practical example.

Laravel 5.8 User Registration And Login System

Laravel comes with an built-in authentication system, that includes out of the box user registration, login, logout, forgot password and remember me functionality. It saves us a lot of time building a custom login and registration system starting from scratch. In this step by step tutorial, we will guide you through building user registration and login using laravel’s built-in authentication package.

Before starting with tutorial, we are assuming that you already have a fresh installation of a Laravel 5.8. If you have not installed it follow Laravel Installation Step.

Install Laravel 5.8

First of all we need to create a fresh laravel project, download and install Laravel 5.8 using the below command

Make sure you have composer installed. Now, lets switch to the project directory and start the development server using following artisan command –

Now, open the following URL in browser to see the output –

http://localhost:8000/

Output:-

laravel-5-7-crud-tutorial-with-example-2

Configure Database In .env file

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

Generate Laravel Application Key

Now, use the following command in terminal to generate laravel application key.

Create Database Migration

Before you run migration, open app/providers/AppServiceProvider.php file and put following two line of code in boot method as following –

Now, use the below command to create required user authentication tables and model automatically.

Authentication Scaffolding

Now, use the below command to generate authentication scaffolding –

This command will generate required Controller files, views and add routes in our web.php routes file that are required for the authentication. If you open your route file (resources/routes/web.php) you can see the authentication route added as following –

The Auth::rutes() is a set of common authentication, registration and password reset routes.

Restart Development Server

Restart the development server using following artisan command –

Test Laravel 5.8 User Authentication

Now, you can see following authentication pages –

http://localhost:8000/register

laravel_user_registration_login_authentication_register

http://localhost:8000/login

laravel_user_registration_login_authentication_login

http://localhost:8000/password/reset

laravel_user_registration_login_authentication_forgot_password

In this tutorial we have learn about the Laravel 5.8 User Registration And Login System and its application with practical example. I hope you will like this tutorial.