Storing and retrieving data from session in laravel 5.6

  laravel, laravel-5

I am using laravel 5.6 and my php is 7.3. I am trying to store data in session. I tried

use Session;
session()->put( 'item_data', [1,2,3]);
dd(Session::get( 'item_data' )); 

it shows value properly but problem is if I tried another request then it’s showing null. That’s mean it’s working instantly storing in session. After that showing null

Source: Laravel

Leave a Reply