Today In this tutorial, you will learn how to create middleware and how it use in laravel 8 applications.

Simply laravel middleware filter all the HTTP requests in laravel based on projects. For example when the user is doing any request that time middleware check user is logged in or not and redirect accordingly. Any user is not logged in but he wants to access the dashboard or other things in projects that time middleware filter requests redirect to the user.

This example of active or inactive users access laravel 8 app or not. So, add this middleware with routes to restrict logged user to access routes, if he/she is inactive by admin.

Step 1: Create Middleware

Open the terminal and execute the following command to create custom middleware in laravel 8. So let’s open your command prompt and execute below command on it to learn PHP middleware:

**php artisan make:middleware CheckStatus**

#laravel #laravel 8 #php

 How to Create and Use Middleware in Laravel 8 applications
4.00 GEEK