I do not understand what is best practice to get data from a database in a MVC framework. I have seen two scenario's:
- Do the database query in the Controller class
$feeds = Feedback::find()->orderBy('RAND()')->limit(4)->all();
- Do the database query in the Model class, and call this method from a Controller class
$categories = Category::getCategoriesList();
What is the correct way? Which tasks should I perform in a Controller class and which should I perform in a Model class?