@dhiru027 by default, the session driver is set to file. it's possible that permissions may not be allowing to write to this file? just a guess.
Nov 28, 2017
2
Level 1
How to use session in custom facade in Laravel 5.5
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:
https://stackoverflow.com/questions/43048945/how-to-use-session-in-custom-class-laravel-5
But nothing change. Please anyone share your solution for this issue?
Thanks in Advance.
Please or to participate in this conversation.