How to create a list of online users?

Good evening!
Want to make the user profiles show information about when he last visited the site. Example: "last seen: Jun 4 16:48". It is necessary, probably, somewhere to insert the query to update the time of the visit.
Prompt, please, as such to implement on the framework Laravel?
July 8th 19 at 16:11
2 answers
July 8th 19 at 16:13
Solution
Create Midler that will update a field in the database with each request. Or to update this field at each login. Depends.
You need to in the questionnaire indicated recent activity. For example, the user clicked through to the page, and then closed the tab. His last action - go to the page. Can you please tell how to do what you wrote? - Arthur_McCullough70 commented on July 8th 19 at 16:16
Cyril, it turns out that this is to approach it from middleware'will need in each controller? - Arthur_McCullough70 commented on July 8th 19 at 16:19
: https://laravel.ru/docs/v5/middleware
To Mildura do not need to contact the controller. This is its convenience. The code in meldware runs to the controller. All you need is to join a group of ranting, which will be used for Midler. - rupert_Weissnat79 commented on July 8th 19 at 16:22
In mallware you need something like this:
if (auth()->check()) {
auth()->user()->touch();
}
- rupert_Weissnat79 commented on July 8th 19 at 16:25
Thank you) - Arthur_McCullough70 commented on July 8th 19 at 16:28
July 8th 19 at 16:15
Will advise then you are in the database with each request to update. Funny.
Make a ws server. When he konekt is open then the user is online. And when konekt closes the updated value in the database.
Hello! Vladimir, can you please suggest how to implement it? And I even never contacted. - Arthur_McCullough70 commented on July 8th 19 at 16:18
: https://habrahabr.ru/post/209864/ - Arthur_McCullough70 commented on July 8th 19 at 16:21
: this option does not suit me, thank you. - rupert_Weissnat79 commented on July 8th 19 at 16:24

Find more questions by tags Laravel