midLaravel
What are Laravel middleware?
Updated May 16, 2026
Short answer
Middleware filters HTTP requests entering the application.
Deep explanation
Middleware acts as a bridge between request and response. It can handle authentication, logging, CSRF protection, and request modification before reaching controllers.
Real-world example
Used to restrict admin routes to authenticated users only.
Common mistakes
- Putting business logic inside middleware.
Follow-up questions
- What is global middleware?
- Can middleware modify response?