• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.