Level 3
I would using cache in auth middleware to saving session ID by user ID and with timestamp, if the number of session is greater than 2 then just logout the older session
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I'm using Laravel 11.x with Jetstream 5.x, and I want to implement a feature where users are limited to a maximum of two active login sessions. If a user logs in on a third device or browser, the oldest session should automatically be logged out. Any advice, examples, or best practices would be greatly appreciated!
Please or to participate in this conversation.