How to start session globally? |
Just make 1 Controller that will extend CodeIngiter Controller and it will be extended by your all other controllers (core extending in docs).
There in the constructor of this App\Controller you can pre-assign all services that you want to be always available as protected variables. Code: $this->session = \Config\Services::session(); At models you have the default database as $this->db available.. Further there is an example how you are able to pick another db connection for a model in case you have multiple DB's with just setting correct DB group.. Code: protected $DBGroup = 'group_name';" Best VPS Hosting : Digital Ocean
|
Welcome Guest, Not a member yet? Register Sign In |