How to load a model in Autoload file |
How can I load a model in ...\app\Config\Autoload.php?
PHP Code: namespace Config; Nothing is working. What is the correct way? Looking for help. Thanks in advance.
You should be able to load it using the ClassMap.
PHP Code: $classmap = [ What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Why push the model to autoload?
The Autoload class is a tool for defining class file paths and including. It is not for loading classes directly.
I want to push some data to $psr4 variable dynamically. And I've to get that data from model.
How could I do that?
Yes, you can add values dynamically.
But you won't create an instance of the model. Take a look at the event documentation. https://codeigniter.com/user_guide/exten...vents.html |
Welcome Guest, Not a member yet? Register Sign In |