My problem is somewhere between the model and the controller. Everything works fine for me when I use MVC only for crud (create, read, update, delete). I have separate models for each database table. I access these models from the controller to crush them. For example, in the contacts application, I have actions (create, read, update, delete) in the controller (contact) to use the model (contact) methods (create, read, update, delete).
The problem starts when I try to do something more complex. There are several complex processes that I donโt know where to put them.
- For example, when registering a user process. I canโt just end this process in the user model, because I have to use other models (sending letters, creating other records for users through other models), as well as many complex checks using other models.
- For example, in some complex search processes, I have to turn to many models (articles, videos, images, etc.).
- Or sometimes I have to use apis to decide what I will do next, or which database model I will use to write data.
So, where is the place to perform complex processes. I do not want to do them in controllers, because sometimes I have to use these processes in other controllers. And I do not want to put this process in the model, because I use models as access levels to databases. Maybe I'm wrong, I want to know. Thanks for your reply.
source
share