Middleware provides a mechanism that helps filter the incoming HTTP request to your application. The basic middleware is explained with authentication. If the user is not authenticated, they will be redirected to the login page, and if the user is authenticated, they will be allowed for further processing. All this is possible with the help of the middleware. Laravel has a php artisan make:middleware <middleware_name> command, helping define the new middleware within your application. By default, the middleware will get stored in the app/Http/Middleware directory.  If you want to run middleware for every HTTP request, list the middleware class within the $middleware property of the app/Http/Kernel.php class. If you want to assign middleware specifically, assign it in the key-value pair at the app/Http/Kernel.php class $routeMiddleware property.