put session in laravel code example

Example 1: set session in laravel

Session::put('variableName', $value);

Example 2: session variable in laravel

$request->session()->put('key','value');

Example 3: laravel session put method

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

session(['key' => 'value']);

Example 4: session flash

session()->flash('key', 'value');

Example 5: session laravel

session(['name' => 'data']);

Example 6: set session data in laravel

$value = Session::get('key');

$value = session('key');

Tags:

Php Example