# Working with Controller
Instead of defining all of your request handling logic as Closures in route files, you may wish to organize this behavior using Controller classes.
Controllers can group related request handling logic into a single class.
Controllers are stored in the.app/Http/Controllers
directory.
Make Controller
php artisan make:controller TrainingController
7 method in controllers
| Action |
|---|
| index |
| create |
| store |
| show |
| edit |
| update |
| destroy |
# Controller - Index
| Description | URL | Controller Function | View File |
|---|---|---|---|
| Default page for showing all the training | GET example.com/trainings | index() | app/views/trainings/index.blade.php |
# Controller - Create
| Description | URL | Controller Function | View File |
|---|---|---|---|
| Show the form to create a new training | GET example.com/trainings/create | create() | app/views/trainings/create.blade.php |
# Controller - Store
| Description | URL | Controller Function | View File |
|---|---|---|---|
| Process the create form submit and save the training to the database | POST example.com/trainings/create | store() | NONE |