Laravel provide us a wonderfull Script for Register, Login with High secruity.
For this task we are just use two artisan command one is for database and second is for Register, Login script
To create database table
php artisan migrate
Note : This command create two table in your database that is users and migrations
To create login and register script
php artisan make:auth
This is command create Route, Pages, and Controller
This route code automatically added in your route
A Controller is create in aap->Http->Controllers->HomeController
class HomeController extends Controller
public function __construct()
public function index()
Auth is a Laravel Facade, Here Auth::check() is use to check user is authenticated or not. if user login it return true otherwise it return false.
In other Laravel provide Auth::guest() is just opposite of Auth::check(), if user not logged in it return true.
Auth::check() - You can check if a user is authenticated or not via this method from the Auth Facade. It returns true if a user is logged-in and false if a user is not. Check here to know how Facades work in Laravel.
Auth::guest() - This does the opposite of Auth::check(). It returns true if a user is not logged-in and false if a user is logged-in. Check here to see all the methods you can call on the Auth Facade.