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


Messages In This Thread
CodeIgniter.com - Report problems! - by atsanna - 03-23-2020, 08:21 AM
RE: CodeIgniter.com - Down / Whoops! - by mladoux - 03-25-2020, 09:19 PM
RE: CodeIgniter.com - Down / Whoops! - by beerye3 - 03-25-2020, 10:44 PM
RE: CodeIgniter.com - Down / Whoops! - by alvino - 03-26-2020, 08:15 AM
RE: CodeIgniter.com - Down / Whoops! - by nige1 - 03-26-2020, 08:55 AM
RE: CodeIgniter.com - Down / Whoops! - by alvino - 03-26-2020, 11:31 AM
RE: CodeIgniter.com - Down / Whoops! - by chez14 - 03-26-2020, 12:58 PM
RE: CodeIgniter.com - Report problems! - by nige1 - 04-28-2020, 08:12 AM
RE: CodeIgniter.com - Report problems! - by leoz - 05-29-2020, 02:42 PM
RE: CodeIgniter.com - Report problems! - by SubrataJ - 03-09-2022, 08:33 AM
RE: CodeIgniter.com - Report problems! - by demyr - 01-19-2023, 12:36 AM
about newer docs - by vkrishn - 03-29-2020, 05:13 PM
help me out - by rainyday - 06-13-2020, 12:53 AM



Theme © iAndrew 2016 - Forum software by © MyBB