Challenge 1: Write Basic Routes With Parameters — Possible Solution ==================================================================== // routes/web.php use Illuminate\Support\Facades\Route; Route::get('/books', function () { return 'All books'; })->name('books.index'); Route::get('/books/{id}', function (string $id) { return "Showing book #{$id}"; })->where('id', '[0-9]+')->name('books.show'); Route::get('/books/category/{slug}', function (string $slug) { return "Books in category: {$slug}"; })->name('books.category'); WHY THIS WORKS -------------- - The book list route needs no parameter at all — it's the simplest form, a static URI mapped directly to a closure. - {id} in the second route captures whatever appears in that URL segment; ->where('id', '[0-9]+') constrains it to a regex of digits only, so a request like /books/abc simply doesn't match this route at all (Laravel would fall through to a 404, or to another matching route defined elsewhere) — this is the closest Laravel gets to Django's built-in converter, though the value still arrives as a string rather than being automatically cast to an integer. - {slug} in the third route has no constraint, matching any non-empty segment — appropriate for a category slug that could reasonably contain letters, numbers, or hyphens. - Every route has a distinct ->name(...) — this is what makes Challenge 2's route grouping (and later, Blade's route() helper) possible without ever hardcoding a literal path string.