Challenge 1: Generate and Wire a Controller — Possible Solution ==================================================================== # Step 1: generate the controller php artisan make:controller AuthorController # Controller created successfully. # app/Http/Controllers/AuthorController.php // app/Http/Controllers/AuthorController.php namespace App\Http\Controllers; class AuthorController extends Controller { public function index() { return 'All authors'; } } // routes/web.php — the step that's easy to forget use App\Http\Controllers\AuthorController; Route::get('/authors', [AuthorController::class, 'index'])->name('authors.index'); WHY THIS WORKS -------------- - php artisan make:controller AuthorController only creates the PHP class file at app/Http/Controllers/AuthorController.php — Laravel's autoloading means the class itself is immediately usable anywhere in the codebase, but nothing in routes/web.php points a URL at it yet. - The `use App\Http\Controllers\AuthorController;` import at the top of routes/web.php is required so the file can reference AuthorController by its short name rather than writing out the fully-qualified App\Http\Controllers\AuthorController::class every time. - Route::get('/authors', [AuthorController::class, 'index']) is the array-callable syntax Laravel uses to point a route at a specific controller method — [ControllerClass::class, 'methodName'] — visiting /authors now actually reaches AuthorController's index() method, closing the gap the chapter's gotcha warns about.