In this video, we dive into Middleware in Laravel 12. You’ll learn what middleware is, how to create your own, how to register it in the application, and how to apply it to routes. We’ll also look at some of the built-in middlewares that come with Laravel out of the box. Perfect for Laravel beginners who want to understand the request lifecycle and how middleware acts as a filter between requests and responses.
👉 Topics covered:
What is Middleware in Laravel?
Creating custom middleware with Artisan command
Registering middleware in the application
Applying middleware to routes
Understanding built-in middlewares (like Authenticate, TrimStrings, and VerifyCsrfToken)
Real example of passing data through middleware
By the end of this tutorial, you’ll have a clear understanding of how middleware works and how you can use it to handle requests in your Laravel projects.
CHAPTERS
=========
0:00 Introduction
0:09 Middleware Mechanism
0:52 Use of Middleware by diagram
1:40 Create Middleware
3:02 Register Middleware in Laravel 12
3:30 Add middleware in route
3:55 Add logic in middleware file
4:15 Check text in view screen
4:25 Conclusion
#laravel12
#middleware