Answer the question
In order to leave comments, you need to log in
Why is laravel authorization not saved?
Good day everyone!
I can't solve the problem for several days now. I dug everything up and nothing helped
. I have my own session driver (I need it). Sessions are written to the database
Here are the write and read methods
public function write($sessionId, $data) {
$payload = $this->getPayload($data);
if(!$this->exists) {
$this->read($sessionId);
}
if($this->exists) {
$this->updateSessionActivity($sessionId);
// return true;
} else {
$this->saveNewSession($sessionId, $payload);
// return true;
}
return $this->exists = true;
}
public function read($sessionId) {
$session = $this->model->where('id', $sessionId)->get()->toArray();
if(isset($session) && !empty($session)) {
$this->checkTimeActivity($session[0]['last_activity']);
}
if($this->exists) {
return base64_decode($session[0]['payload']);
}
}
public function handle($request, Closure $next) {
if(Auth::check()) {
return 'check';
// return $next($request);
} else {
return redirect()->route('myloginget');
}
}
'driver' => env('SESSION_DRIVER', 'customsession'),
'lifetime' => env('SESSION_LIFETIME', 1440),
'table' => 'sessions,
'secure' => env('SESSION_SECURE_COOKIE', false),
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question