declare session laravel code example
Example 1: session variable in laravel
$request->session()->put('key','value');
Example 2: session flash
session()->flash('key', 'value');
$request->session()->put('key','value');
session()->flash('key', 'value');