Table of Contents
We know that in a laravel website or generally in any other web application user can login to the dashboard from multiple devices.
Means the user can login on PC's browser and at the same time can login from mobile browser or from any other devices from anywhere.
But for some web applications like video streaming or courses online selling , clients need the feature in that the same user should not allow login from multiple devices. So, to prevent the user login details to share to other users. It helps to prevent login details share and misuse.
We will achieve this feature in a simple way in a laravel application. If a user login in another device, The first logged in user will automatically logged out. Means the user can login only one device,browser at a time .
Let's start to achieve this.
1) Inside Kernel.php
Uncomment below line
2) Inside App\http\Controllers\LoginController.php
add below function. also inject below
It's done . It was just simple steps to Laravel prevent login the same user in multiple devices.
Contact us If you are looking to hire experienced PHP Laravel Developer .