Welcome Guest, Not a member yet? Register   Sign In
What is the correct way to load data from a databse once for use everywhere?
#4

(02-11-2023, 02:52 PM)kenjis Wrote:
(02-11-2023, 08:32 AM)objecttothis Wrote: From what I can tell that will work, but unless I'm mistaken, every time config('foo')->bar gets called its going to call the constructor and pull all that data down from the database.  This defeats the purpose of trying to "load it into memory" once for use everywhere.

You are mistaken.
See https://codeigniter4.github.io/CodeIgnit...-factories

Sounds like you are both saying Factories. Is there an advantage that factories has over loading the table values into session data and then referencing them using session('key');?
Reply


Messages In This Thread
RE: What is the correct way to load data from a databse once for use everywhere? - by objecttothis - 02-11-2023, 03:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB