check laravel sess code example
Example 1: session variable in laravel
$request->session()->put('key','value');
Example 2: session laravel
session(['name' => 'data']);
$request->session()->put('key','value');
session(['name' => 'data']);