mardi 24 novembre 2015

Laravel 5: Sessions not working the way they should

On top of every controller and routes.php I used:

use Illuminate\Support\Facades\Session;

In routes.php I set the session using:

Session::put('key', 'value');

In a controller I want to call the session value of key using:

echo Session::get('key');

But once I set a new value to key in routes.php and call it in a controller, I still get the first value and not the new one. If I echo the the session using Session::all() in routes.php after setting it, I see the new value, but in a controller it flips back to the first value. I even tried using below in routes.php before setting the new value, but without success.

Session::forget('key');

Am I forgetting something here?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire