Reputation: 1144
I'm new in Laravel 5.8 and I need to set a session manually I use this code Session::set('subset', 'yes');
but I get error how to set session manually in Laravel 5.8
Upvotes: 0
Views: 210
Reputation: 1814
Set the session variable with value as follows..
Session::put('key','value');
Retrieve value using
In controller
$value = Session::get('key');
In view
{{Session::get('key')}}
Upvotes: 1
Reputation: 399
You can use the global session helper which is available in laravel 5.8.
Set session simply by using
session(['key' => 'value']);
Retrieve session using
$value = session('key');
Upvotes: 0