+1 vote
in Laravel by
What is Middleware and how to create one in Laravel?

1 Answer

0 votes
by
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.

Related questions

+2 votes
asked Jul 11, 2021 in Laravel by rajeshsharma
+1 vote
asked Jul 12, 2021 in Laravel by sharadyadav1986
...