Welcome Guest, Not a member yet? Register   Sign In
CI4 where should I connect to DB?
#1

I'm writing models that use query builder with joints and many other funny stuf. Since CI4, we need to manually connect to the DB :

Code:
$db = \Config\Database::connect()

Where should I place this connection line of code :
  • when I have to use $db in several models ?
  • when IĀ use $db only in one models ?
Reply


Messages In This Thread
CI4 where should I connect to DB? - by imabot - 05-07-2020, 11:32 PM
RE: CI4 where should I connect to DB? - by imabot - 05-09-2020, 10:49 PM
RE: CI4 where should I connect to DB? - by imabot - 05-10-2020, 05:46 AM
RE: CI4 where should I connect to DB? - by imabot - 05-11-2020, 09:06 AM



Theme © iAndrew 2016 - Forum software by © MyBB