Hello Laravel Friends,

Today we will learn about How to Make Admin Auth in Laravel 8.

Admin authentication is required in Laravel when you work with web applications. So here I will explain How to Make Admin Auth in Laravel 8 in a step-by-step way.

MageComp Official Facebook Group

So let’s start the Admin Auth in Laravel 8.

Steps to Make Admin Auth in Laravel 8:

Step 1:  Create an admin table in the database

Create one migration for admin and add “name, email, password, created_at, updated_at” fields in the “admins” table

Step 2: Add Guards

To add guards, you need to make the following changes in the config/auth.php file.

Step 3: Add admin auth middleware

Run the below command

Now, move to the below path

app/Http/Middleware/AdminAuthenticated.php

And add the code as follows

Step 4: Add Middlewave in Kernel.php file

Move to the following path

app/Http/Kernel.php

Now add the code as follows

Step 5: Add Admin Login Routes

Go to the below-mentioned path

routes/web.php

Now add the below code

Step 6: Create AdminAuth controller 

Run the following command

Then navigate to the following path

app/Http/Controllers/Admin/AdminAuthController.php

And add the below code snippet

Step 7:  Create a Blade file

Go to the below path

resources\views\admin\auth\login.blade.php

And add the code as follows

Step 8: Admin Dashboard View

Move to the following path

resources\views\welcome.blade.php

Add the code as follows

Step 9: Run your Laravel application

Now, the admin auth is ready for the login. just run your Laravel application using the following command in the terminal.

Then open the browser and paste the following URL into your browser

http://127.0.0.1:8000/admin/login

Output:

Admin Login

Admin Auth in Laravel 8

Conclusion:

This way you can easily Make Admin Auth in Laravel 8. Alternatively, you can also Perform Laravel Authentication with Breeze.

If you have any doubt, share them with me through comments and stay updated for more Laravel tutorials.

Happy Coding!

Click to rate this post!
[Total: 68 Average: 4.1]