Controllers group related request-handling logic into classes, stored in app/Http/Controllers. Resource controllers (php artisan make:controller PostController --resource) provide the standard CRUD methods index, create, store, show, edit, update, destroy. Single-action controllers use an __invoke method for simple, focused actions.
← Laravel theorytheory 0/50 · 0%
Fundamentals · easy
5. Controllers
Organizing route logic.
Check your understanding
1. Which artisan command generates a resource controller?
2. What method is used in a single-action controller?