Using Preloaded Model Via BaseController in Other Controllers |
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! ***/ |
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
|