Welcome Guest, Not a member yet? Register   Sign In
Using Preloaded Model Via BaseController in Other Controllers
#2

Quote:I would have thought that since I am extending from that 'base' model, I would not have to instantiate it in the constructor?

You don’t need to instantiate it if you extend the class. Show some more code, you’re doing something wrong.

I’m not sure what you’re trying to do, but you can load a shared instance of a model with the model() function. You don’t need to load it globally in the base controller in case you need it.

Also, the controller already has the request object in $this->request. You don’t need to load it.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply


Messages In This Thread
RE: Using Preloaded Model Via BaseController in Other Controllers - by includebeer - 10-10-2021, 05:09 AM



Theme © iAndrew 2016 - Forum software by © MyBB