Laravel 5.8 Login and Registration Part — 1
Hi Guys,
In this posts, we have to learned about Login and Registration in Laravel Version 5.8. So Lest’ Started.
Step 1 : Laravel Installation
You have to install the laravel in your system. Open your terminal and past this link.
composer global require laravel/installer
Note : before using Laravel, make sure you have Composer installed on your machine. Here is the link composer download link : https://getcomposer.org/
Step 2 : Create a project
Once installed, this command will create a directory firstproject.
laravel new firstproject
This command will be create a directory and installed all laravel dependencies.
OR
Create-Project Via Composer
Alternatively, you may also install Laravel by using composer.
composer create-project --prefer-dist laravel/laravel firstproject "5.8.*"
This command will install only laravel version 5.8 dependencies. your project is ready run.
Step 3: Run Project
go to your terminal and set the path your project. and run this command
php artisan serve
Step 4 : Connect Mysql Database
Go to your .env file in your root directory. and enter username,password and database name.
DB_DATABASE=firstdb # Enter your Database name
DB_USERNAME=root # Enter your Database username
DB_PASSWORD= # Enter your Database password By default it
should be blank
Now, your project is connected your database.
Step 4 : Create default login and regiser
Laravel provides a quick way to scaffold all of the routes and views you need for authentication using one simple command:
php artisan make:auth
This command should be used on fresh applications and will install a layout view, registration and login views, as well as routes for all authentication end-points. A HomeController
will also be generated to handle post-login requests to your application's dashboard.
Step 5: Reload your project again.
Now go to your browser and reload page. you can see you have to redirect login page. By default laravel generate view register,login,forgot password,verify password,reset password page. you can see in resources->views->auth directory. also change ui depending your project requirement.
But, it’s not working because your database have no any table to store data. you have to create table using migrations. run this command
php artisan migrate
This command will be generated users and migrations table .
Users : This table used for storing users data.
Migrations : This table used to history of migrations table.
Now, you can reload your browser and check again register and login.
Thanks For Reading My Articles.
Upcoming Articles setup mail for Forgot Password throw gmail.