Using Preloaded Model Via BaseController in Other Controllers |
Personally I would collect what I need from the request in the controller, and pass this to the model as a parameter. This way the model is not dependent on the incoming request and only deal with database requests. It would also make it easier to test your model if you can just pass an array of options.
But like you said, CI doesn’t force anything and let you do what you want, how you want. So it’s up to you. But I advise to stay as close as possible to the MVC pattern.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/ |
Messages In This Thread |
Using Preloaded Model Via BaseController in Other Controllers - by Mr Lister - 10-09-2021, 11:31 PM
RE: Using Preloaded Model Via BaseController in Other Controllers - by includebeer - 10-10-2021, 05:09 AM
RE: Using Preloaded Model Via BaseController in Other Controllers - by Mr Lister - 10-10-2021, 11:43 PM
RE: Using Preloaded Model Via BaseController in Other Controllers - by includebeer - 10-11-2021, 08:37 AM
RE: Using Preloaded Model Via BaseController in Other Controllers - by Mr Lister - 10-11-2021, 03:09 PM
RE: Using Preloaded Model Via BaseController in Other Controllers - by InsiteFX - 10-12-2021, 01:36 AM
RE: Using Preloaded Model Via BaseController in Other Controllers - by includebeer - 10-12-2021, 03:13 PM
RE: Using Preloaded Model Via BaseController in Other Controllers - by Mr Lister - 10-13-2021, 12:58 AM
|