A controller is the C
in the MVC
model–view–controller, and Laravel is an MVC
framework. The controller is where you enter or code most of your application logic. The good news is that you can create as many controllers as your application needs, allowing your application codes to have an easy-to-understand syntax.
You will route HTTP requests to your controller to handle.
To create a controller in Laravel, you just need to run an artisan command:
php artisan make:controller ControllerName
.
Now you are set to start coding your logic. All of your controllers will be located in the app/Http/Controllers
folder. I have also written a shot on resourceful controllers that will provide a deeper explanation.