DEV Community

techdurjoy
techdurjoy

Posted on

Laravel 9 Multiple Authentication Example using Guard

In this post we will give you information about Multi Auth Laravel 9 | Multiple Authentication in Laravel 9. Hear we will give you detail about Multi Auth Laravel 9 | Multiple Authentication in Laravel 9 And how to use it also give you demo for it if it is necessary.

To create multi auth in laravel i am using laravel guard. Many web applications need to user and admin management system. That time we need multiple login system like student login, user login, admin login, etc.

Now i am going to show you how we can create these multiple user and admin login systems in laravel. In this tutorial, we’ll use a guard to create this multi authentication system. Laravel default login system, laravel use web as a default guard.

I will use laravel custom guard to manage laravel multiple authentication in laravel 9. If you go to your loginController.php then you can see it use the AuthenticatesUsers trait. So we will see that what is happening here.

If you go to this file which locates this following path

vendor\laravel\framework\src\illuminate\Foundation\Auth\AuthenticatesUsers .php

After going through this file just go to the bottom of this file and you will see a lot of code of the login system. But now we are going to create our own multi-auth system in laravel 9.

Sometimes we need student login, teacher login, and admin login etc. In such kind of situation, we need multi-auth in web applications. Laravel provides an awesome thing to do multi auth using a guard.

So in this example tutorial, I am going to show you how we can create a multi auth system in our laravel 9 application.

Laravel 9 Multiple Authentication Example using Guard

Top comments (0)