I am writing a web application using PHP without using any framework 'just for learning'.
My app consists of a small routing system, MVC components, some entities that represents the database tables and repository classes that deals with the database.
The controller crate a repository object and that object load its entities from the database then return it as an array to the controller and the controller render the data.
What is the right place to put the domain or business logic,
in the models or repositories
View > Controller > Model > Repository > Database
View < Controller < Model < Repository < Database
Top comments (3)
If you follow the MVC model and it is a small app. You could go for fat models and thin views approach by putting your business logic into the model.
That's not my intent, my intent to put every thing in the right place.
It's not a real application it's just for learning.
Thank you :)
There's not right or not it just depends on what is the use case you are solving.