DEV Community

Cover image for How to use multiple authentication guards in Laravel 6 app
siddharth shukla
siddharth shukla

Posted on

How to use multiple authentication guards in Laravel 6 app

Prerequisites

PHP >= 7.1.3
OpenSSL PHP Extension
PDO PHP Extension
Mbstring PHP Extension
Tokenizer PHP Extension
XML PHP Extension
Ctype PHP Extension
JSON PHP Extension

Getting started

Check all Prerequisites are installed in your machine. then this tutorial is already looking for you, we will create 3 user class – admin, blogger, user and we will make guards for 3 user classes and restriction different parts of the application based on those guards.

Create the application
We need to run command to create laravel 6 projects.

laravel new laravel_multi
After creating the app, now comes on the folder.

cd laravel_multi
Now configure database in .env file

Example:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel_multi
DB_USERNAME=root
DB_PASSWORD=root@123

Read complete: https://realprogrammer.in/how-to-use-multiple-authentication-guards-in-laravel-6-app-2/

Top comments (0)