Factories in docs explained badly |
I'm trying to figure out how to use factories in CI4.
But the documentation is not up to par on explaining it. For example here:https://codeigniter.com/user_guide/conce...ories.html Code: <?php This example seems to be a mix of the Config/Factory.php and Factories.php files mentioned above the code. Anyone here that can give a working example? Both files mentioned, and where do I place the Factories.php file? in app/Factories ? Any help would be appreciated. Thanks. Code: $data = Factories::myfactoryfunction('Data'); How do I create a new Factory function like above? Shouldn't be too hard i guess, but I can't figure it out by reading the documentation. And I haven't found any examples searching the web. Any help appreciated.
Yes, it is difficult to understand how to use Factories.
How about this? PHP Code: $data = Factories::myfactoryfunction(Data::class);
Hello guys,
I found how to do. Create the file app/Config/Factory.php where to set these options. Then check that the namespace is Config such as te other config file (not App/Config). Hope this help you. |
Welcome Guest, Not a member yet? Register Sign In |