Introduction
Middleware provide a convenient mechanism for inspecting and filtering HTTP requests entering your application. For example, Laravel includes a middleware that verifies the user of your application is authenticated. If the user is not authenticated, the middleware will redirect the user to your application’s login screen. However, if the user is authenticated, the middleware will allow the request to proceed further into the application.
Defining Middleware
To create a new middleware, use the make:middleware Artisan command:
php artisan make:middleware EnsureTokenIsValid

Leave a Reply