Answer the question
In order to leave comments, you need to log in
How to extract session data correctly?
Now I have these crutches :D
I'm sure that there is a simpler method) in the Laravel documentation I did not find how to extract session data by ID)
Answer the question
In order to leave comments, you need to log in
If I were you, I would look at how the framework itself solves this problem .
These are protected methods, so you may have to copy their code to yourself. I'm not sure if it's possible to replace this class with one inherited from it, or somehow get through to these methods without copying. But, in the worst case, these are three lines.
And Store
and EncryptedStore
take the session id as the last argument.
UPD :
Everything is much simpler:
/** @var \Illuminate\Session\Store $otherSession */
// Клонируем для того, чтобы не испортить оригинальную сессию текущего пользователя.
// Её, конечно, может и не быть, но клонирование всё равно позволит избежать проблем.
$otherSession = clone \Session::driver();
$otherSession->setId('your-id-here');
$otherSession->flush();
$otherSession->start();
dd($otherSession->all());
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question