Why this lesson matters
Understand route parameters and names and apply it in a small Laravel feature. Routing turns an HTTP method and URL into an explicit application entry point; controllers should coordinate that request without becoming the home of every business rule.
How to reason about it
- For Route Parameters and Names, the outcome to verify is: A route name keeps callers from hard-coding URLs.
- In Route Parameters and Names, keep this failure controlled: A route that is too broad or a controller that owns validation, persistence and business policy becomes difficult to test and change.
- Route Parameters and Names practice target: Add one named route with a parameter, connect it to a controller action, then generate its URL by name.
Practical walkthrough
In the Route Parameters and Names walkthrough: A route name keeps callers from hard-coding URLs.
routes/web.phpphp
use App\Http\Controllers\UserController;
use Illuminate\Support\Facades\Route;
Route::get('/users/{user}', [UserController::class, 'show'])
->name('users.show');Practice it yourself
Route Parameters and Names exercise
Add one named route with a parameter, connect it to a controller action, then generate its URL by name.
- Record the expected result before execution
- Test one valid path and one lesson-specific failure path
- Explain in two lines which boundary owns the decision
