Laravel Middleware - Short Intro

1447545600000 php laravel Laravel Middleware

by Start Bootstrap


This is the post about Laravel's Middleware

Middleware is one of the cool way that is included in Laravel 5, It focuses mainly on dealing with the request that reaches application. The Laravel 5 users are highly adviced to use this feature to make use of it. 

Middlware can be enabled or disabled (included or excluded) from Kernal.php file inside the `Http` Folder.

This is the proper  prodefinition given by Laravel about Middleware

HTTP middleware provide a convenient mechanism for 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 the login screen. However, if the user is authenticated, the middleware will allow the request to proceed further into the application.

We can create our own middleware using artisan command 

make:middleware

php artisan make:middleware OldMiddleware

And we can also do actions before reaching and after reaching Middleware. Read the docs to know more about Middlware