How to logout a user from all devices on Laravel Passport? Super easy way

A little ago I was told by my restaurant app client to change a user password and log out the user from all devices and force it to login again with a new password. He wants to make sure that any old employee does not have access to their turnover and can not control the app. Then I thought to just change the password of that user and the problem will be solved. But, this did not do! I used the Laravel Passport oauth2 library to authenticate API users and when the password is changed no users will be logged out because of active access tokens. Even I deleted the tokens and tested that refresh token on the front and will just call endpoint to create a new access token and the user will continue to use the app without responding to the password change. So I decided to solve the problem and fix the issue for my client. Luckily, I found a way!
After a little research, I see that revoking an access token will force a user to use a refresh token and get a new token to continue auth API endpoints. There is a revoke() function to do so. But we need to terminate all active sessions and I have created a minor function to solve this problem. Firstly, I want to show the main part of the function:







