Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter.com - Report problems!
#61
Sad 

(03-09-2022, 12:27 AM)InsiteFX Wrote: CodeIgniter 4 uses Events instead of Hooks. So you want to read up on the CodeIgniter 4 Event system.

Hello, Thanks for the help, I understand now how it works, but I am trying to get these settings available globally, 

Code:
ErrorException
Creating default object from empty value
APPPATH/Config/Events.php at line 58

52 Events::on('pre_system', static function () {
53    $configs = Database::connect()
54                    ->query('SELECT * FROM setting ')
55                    ->getResult();
56    foreach($configs as $config)
57    {
58        config($config->setting_type)->{$config->name} = $config->value;
59    }
60 });

I have theese three fields in my table seting_type has simmilar value, name and value has respective value. could you plese tell me what I am doing wrong here?
Reply
#62

Please read this.

CodeIgniter 4 User Guide -> Generating Query Results -> Result Arrays
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#63

(03-10-2022, 01:03 AM)InsiteFX Wrote: Please read this.

CodeIgniter 4 User Guide -> Generating Query Results -> Result Arrays

Thanks! I've looking for this for a while now
Reply
#64

thanks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB