I'm new at MVC and my first framework is Laravel (3 for now). I've started coding exclusively in the routes, and I moved to the controller. I'm however doing all of my database operations in the controller. I do not understand how to use the model.
Examples either demonstrate everything in the controller or in the route, but they never split the model, controller and view.
Could anyone kindly explain me how to use the model? In short I don't understand how to link one to each other, like sending form input to them model, or processed data back to the controller.
A github repo of a Laravel (v3 if possible) with a full MVC setup would be nice to analyze too, if anyone has one up for me to look at?
Thanks.
The best statement on the subject of Frameworks I've heard is due to Uncle Bob:
A good Architecture allows major decisions to be deferred!
Specifically:
- A good Architecture delays choosing a Framework!
Another great piece to think about:
MVC is not an Architecture! It is a Delivery Design Pattern.
Watch his video - it is one of the sadly few ones out there that don't spend 1000 words on what can be said in 10 and I can't highly enough recommend it - and it will help you to understand many points raised in your question:
Robert C Martin(Uncle Bob) -Clean Architecture and Design - Video
Of course, his book on Clean Code is also highly recommended!
Although this link is for Laravel 4 docs, it may help you understand how the models work - (Laravel 3 also uses Eloquent):
http://laravel.com/docs/eloquent
Also, specific to laravel 3:
http://codehappy.daylerees.com/eloquent-orm