I am new to Laravel and working on version 5.5. For my knowledge, I have created custom facade and now I am trying to set some session values into this facade as well as try to get the value of set session.
But Laravel is not able to set session in this custom facade. If I do the same thing in controller then it is working fine.
Below are my possible way that I have tried:
public function setUserSession() {
//Ist way
session()->put('user', 'some values');
var_dump(session()->has('user')); // this is returning me false
//2nd way
request()->session()->put('user', 'some values');
var_dump(request()->session()->has('user')); // this is returning me false
Session::set('user', 'some values'); //this is giving me error
/* for above line I have include below namespace:
1.Illuminate\Support\Facades\Session
*/
var_dump(Session::get('user')); // this is returning me false
}
Even I have tried the solutions of below link:
How to use session in custom class laravel 5?
But nothing change. Please anyone share your solution for this issue?
Thanks in Advance.
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2Af9lhE
via IFTTT
Aucun commentaire:
Enregistrer un commentaire