Hi everyone,
I'm new with CI (4.1.9) and my first steps went well.
But now I'm facing some issue with the session helper.
1.)
I added the following code in my BaseControllers InitController method.
PHP Code:
$this->session = \Config\Services::session();
When I use it with $this->session->get() in my controller everything works fine. But I get a
Code:
Call to a member function get() on null
as soon as I use it in one of my models.
How can I use the session service within my models?
2.) In case I check the existence of a session variable I get always a true, even if the variable is not existing.
PHP Code:
$this->session->has('test');
Now I'm checking, if this session is null.
Why is the return value of the code above always true?
Thanks in advance.
Could someone support me?