I have a User model, with properties (id, username, email, password) and methods (is_unique, get_by_id, save).
As I understand the MVC pattern, my User model has to represent one given user.
So, if I want to get a list of all users, should I implement a method for this in User model, or in a controller?
I have a User model, with properties (id, username, email, password) and methods (is_unique,
Share
You would have to build a UserCollection model, containing a collection of User models if you want to do it the proper MVC way. Your controller can never interact with the database directly, hence why we have to create a model 😉