Recall & Review
beginner
What is routing in Laravel?
Routing in Laravel is the process that connects a URL to a specific piece of code or logic that runs when that URL is visited.
Click to reveal answer
beginner
Why does Laravel map URLs to logic?
Laravel maps URLs to logic so the app knows what to do when someone visits a certain web address, like showing a page or saving data.
Click to reveal answer
intermediate
How does Laravel know which code to run for a URL?
Laravel uses route definitions in files like
routes/web.php to match URLs to controller methods or closures that contain the logic.Click to reveal answer
beginner
What happens if a URL does not match any route in Laravel?
Laravel shows a 404 error page because it does not know what logic to run for that URL.
Click to reveal answer
beginner
Give an example of a simple route in Laravel that returns a view.
Example:
Route::get('/home', function () { return view('home'); }); This maps the URL '/home' to logic that shows the 'home' page.Click to reveal answer
What does Laravel routing connect?
✗ Incorrect
Routing connects a URL to the code that should run when that URL is visited.
Where do you define routes in a Laravel app?
✗ Incorrect
Routes are defined in the routes/web.php file.
What happens if no route matches a URL in Laravel?
✗ Incorrect
Laravel shows a 404 error page if no route matches.
Which HTTP method is used in this route?
Route::get('/about', ...)✗ Incorrect
The 'get' method defines a route for HTTP GET requests.
Why is routing important in a web app?
✗ Incorrect
Routing directs URLs to the correct code to handle requests.
Explain in your own words why Laravel uses routing to map URLs to logic.
Think about what happens when you visit a website address.
You got /5 concepts.
Describe how you would create a route in Laravel that shows a welcome page when visiting '/welcome'.
Look at how routes are defined in routes/web.php.
You got /4 concepts.