(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?