DEV Community

Cover image for How To Use/Create Middleware Laravel 8 Example
Robert Look
Robert Look

Posted on

How To Use/Create Middleware Laravel 8 Example

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.

Middleware- Laravel 8- Use/Create the make: middleware Artisan command

Top comments (0)