A
A
Apostol632020-02-18 14:18:57
Laravel
Apostol63, 2020-02-18 14:18:57

How to get laravel session expiration time?

Hello!
I write sessions to a database.
But there (by default) the time when the session time expires is not written.
How can I get, or better yet, write to the database the exact date and time of the end of the session?

PS
Yes, I set the session lifetime in config/session.php
But I need that when writing a new session to the table, the time of its "death" is also written there. Of

course, this can be done after. Those. get the current session by id and add it yourself, but it seems to me that this is a crutch. A specific crutch.
Is there any method out of the box?

Thank you all in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Aksentiev, 2020-02-18
@Apostol63

created_at + session lifetime = death time
Only a session dies if it is not used.
If you use the site, then the session will not die.
So the last login of the user + session lifetime = time of death
In general, the task is not clear in what situation this information may be needed at all.
For any actions of the site visitor, we can assume that the session has just been created, and will die at least after the session lifetime.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question