Using Preloaded Model Via BaseController in Other Controllers |
(10-10-2021, 11:43 PM)Mr Lister Wrote: I am now at the point where I receive Attempt to read property "uri" on null on the following line: You have this error because you never pass the request object to your model, $request is null: PHP Code: $base_markup = $this->_base_layout_markup(); // nothing is passed for the $request parameter A model is tied to a database table. Yours seemed to be tied to a specific controller, which is weird in my opinion. I’m not sure either why your model need to access the request object. If you follow the MVC pattern, this would be a job for the controller. The models are used for database operation, not dealing with the request and user input.
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
|