luijay
134
4
Laravel

How to use session in controller

Posted 1 week ago by luijay

Hi, I'm trying to use Session in controller. Can the stored value in session be used in laravel controller ? I can store data to session from my controller but whenever I try this die(var_dump(Session::get('variable'))); It says undefined variable session. This is how I store my value in session -> Session::put('variable', $value); and this is how I get my data Session::get('variable');. The problem is can session get be used in different controller ? by just calling session::get('variable');

Please sign in or create an account to participate in this conversation.