Laravel 8 and Global Session
Hi,
I'm trying within my webapp to use the Laravel's global session to store some infos. I decided to use the database driver to store the informations.
I've followed the setup as described in the official documentations and in effect after the login I see in the DB's session table the record for the current session.
Then, inside the controller's construct function I store the variable in the global session as this:
session()->put('variablename', $variable);
To test it, I follow this code with a simple
var_dump(session()->get('variablename'))
and it works fine.
The problem appears when in another controller I try to access this variable with another
session()->get('variablename');
and get a not so nice NULL.
What am I doing wrong? The official documentation is ok, but dig not so deep in database driver's topic, so probably I'm missing something.
An well anticipated thanks for the help.
Kind regards
Lowelheim
Please or to participate in this conversation.