Click here for more interview questions
Middleware acts as bridge between request and response.
Middleware verifies the user is authenticated or not depends on this it is redirect to home and login page.
command to create middleware
php artisan make:middleware
Two types of middleware in laravel
global middleware- run on every http request
routemiddleware-assigned to a specific route
middleware can be register inside app/kernel.php file as $routemiddleware[],$middleware[];
Click here for more interview questions