# 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

Controller

7 method in controllers

Action
index
create
store
show
edit
update
destroy

# Controller - Index

DescriptionURLController FunctionView File
Default page for showing all the trainingGET example.com/trainingsindex()app/views/trainings/index.blade.php

Controller

# Controller - Create

DescriptionURLController FunctionView File
Show the form to create a new trainingGET example.com/trainings/createcreate()app/views/trainings/create.blade.php

Controller

# Controller - Store

DescriptionURLController FunctionView File
Process the create form submit and save the training to the databasePOST example.com/trainings/createstore()NONE

Controller

Controller