What is a Laravel controller?

widget

What is a Laravel controller?

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.

New on Educative
Learn any Language for FREE all September 🎉
For the entire month of September, get unlimited access to our entire catalog of beginner coding resources.
🎁 G i v e a w a y
30 Days of Code
Complete Educative’s daily coding challenge every day in September, and win exciting Prizes.

Free Resources