Recall & Review
beginner
What is the main purpose of middleware in Laravel?
Middleware acts like a gatekeeper that checks each request before it reaches your app. It can allow, block, or modify requests to keep your app safe and organized.
Click to reveal answer
beginner
How does middleware help with security in Laravel?
Middleware can check if a user is logged in or has permission before letting them access certain parts of the app, protecting sensitive data.
Click to reveal answer
beginner
Give an example of a common middleware filter in Laravel.
The 'auth' middleware checks if a user is authenticated. If not, it redirects them to the login page.
Click to reveal answer
intermediate
Why is middleware useful for modifying requests or responses?
Middleware can add headers, log information, or change data before the app handles it or before sending it back to the user, making the app flexible.
Click to reveal answer
intermediate
What happens if middleware blocks a request in Laravel?
The request stops and does not reach the app’s main code. Middleware can send a response like an error or redirect instead.
Click to reveal answer
What does Laravel middleware do with incoming requests?
✗ Incorrect
Middleware filters and processes requests before they reach your app's core logic.
Which middleware would you use to check if a user is logged in?
✗ Incorrect
The 'auth' middleware checks user authentication status.
What can middleware do if a request is not allowed?
✗ Incorrect
Middleware can block requests and respond with errors or redirects.
Middleware can modify which of the following?
✗ Incorrect
Middleware can change both incoming requests and outgoing responses.
Why is middleware important for organizing a Laravel app?
✗ Incorrect
Middleware separates concerns by handling checks outside the main app logic.
Explain in your own words why Laravel uses middleware to filter requests.
Think about how a security guard checks people before entering a building.
You got /5 concepts.
Describe a situation where middleware would block a request and what happens next.
Imagine trying to enter a locked room without a key.
You got /4 concepts.