Middleware gives developers the ability to inspect and filter incoming HTTP requests of our application. One such middleware that ships with laravel are the authentication middleware which checks if the user is authenticated and if the user is authenticated it will go further in the application otherwise it will throw the user back to the login screen.
We can always create a new middleware for our purposes. For creating a new middleware we can use the below artisan command:
php artisan make:middleware CheckFileIsNotTooLarge
The above command will create a new middleware file in the app/Http/Middleware folder.