LARAVEL Routing & Middleware Flashcards
6 cards from real LARAVEL practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 6 LARAVEL Routing & Middleware flashcards as text
What does `Route::group()` allow you to do in Laravel?
Answer: Share route attributes like prefix and middleware across multiple routes
Route::group() lets you share attributes such as middleware, prefix, or namespace across a set of routes.
Which method is used to generate a URL for a named route in a Laravel Blade template?
Answer: route('route.name')
The route() helper function generates a URL for a given named route in both Blade templates and PHP code.
What is the purpose of route model binding in Laravel?
Answer: Automatically inject a model instance into a route based on a URI segment
Route model binding automatically resolves and injects an Eloquent model whose key matches the route segment.
What does `Route::resource()` automatically create in Laravel?
Answer: Seven RESTful routes mapping to controller methods (index, create, store, show, edit, update, destroy)
Route::resource() generates the standard seven CRUD routes tied to a resourceful controller in a single declaration.
Which middleware is responsible for protecting routes against Cross-Site Request Forgery in Laravel?
Answer: \App\Http\Middleware\VerifyCsrfToken
The VerifyCsrfToken middleware checks every POST/PUT/PATCH/DELETE request for a valid CSRF token.
How do you define an optional route parameter in Laravel?
Answer: By appending a ? to the parameter name, e.g. {param?}
Adding a ? after the parameter name marks it as optional, and you must also provide a default value in the closure signature.
How this page was made: written with AI tools and published by Nathan Beja, founder of Practice Test Geeks, who is responsible for its content. We have not yet matched this exam's facts to an official source, so confirm fees, dates and rules with the exam body. Not reviewed by a subject-matter expert. Editorial policy