Answer the question
In order to leave comments, you need to log in
MVC - where should the logic be?
I understand with MVC on PHP. I still can’t decide where to write the logic: in the controller or in the model. Opinions on the Internet also differ greatly, someone says that the conditions should be written in the controller, someone in the model. Those. there are fat models and thin controllers and vice versa - thin models and thick controllers. And I wonder what influenced your choice?
Answer the question
In order to leave comments, you need to log in
The logic of working with a database or other data source - write in the Model
Logic for processing requests from the user (GET, POST, ...) -
everything is logical in the Controller, isn't it?
Personally, I displayed the logic in a separate layer, if there was a lot of it. Then it was convenient to accompany all this stuff.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question