Authentication in Laravel

Authenticationopen in new window is such a important and commonly used feature, that Laravel has made implementing authentication very simple.

Adding Authentication

The simplest way to add authentication to a Laravel project is use the Laravel UI package. To install the package, run the following command:

composer require laravel/ui --dev

With the package installed, artisan can be used incorporate authentication into a project. Laravel include several different options for the UI component include Bootstrap and Vue. From the project root directory run ONE of the following commands:

## INSTALL ONLY ONE

# to install with Bootstrap
php artisan ui bootstrap --auth

# to install with Vue
php artisan ui vue --auth

Creating Users Table

In order to the Laravel authentication a users table must be created in the project database. Fortunately, Laravel provides the migration file for create the users table. To use the migration file to create the users table, run the following command:

php artisan migrate