https://github.com/barchart/laravel-remember-all
A Laravel session driver to remember all devices a user has logged in with.
https://github.com/barchart/laravel-remember-all
laravel remember-many remember-me remember-multiple session session-management
Last synced: about 1 year ago
JSON representation
A Laravel session driver to remember all devices a user has logged in with.
- Host: GitHub
- URL: https://github.com/barchart/laravel-remember-all
- Owner: barchart
- License: mit
- Created: 2018-10-08T16:27:06.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-09-30T11:31:49.000Z (over 3 years ago)
- Last Synced: 2025-03-29T03:31:59.923Z (about 1 year ago)
- Topics: laravel, remember-many, remember-me, remember-multiple, session, session-management
- Language: PHP
- Size: 13.7 KB
- Stars: 30
- Watchers: 16
- Forks: 12
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Laravel Remember All Devices
Laravel currently only supports the "remember me" feature for one device. When you log in to multiple devices, then log out of one, you will be logged out of all. This solves that by storing the tokens in a separate table.
There is a current proposal to put this into Laravel core, but we needed this now: https://github.com/laravel/ideas/issues/971
### Setup
Install via composer:
```
composer require barchart/laravel-remember-all
```
Migrate the new `remember_tokens` table:
```
php artisan migrate
```
Update your authentication guard:
```php
'guards' => [
'web' => [
'driver' => 'rememberall',
'provider' => 'users',
'expire' => 10080, // optional token expiration time, in minutes (7 days is the default)
],
],
```
#### Eloquent
For Eloquent, you also need to update your model. Just replace Laravel's default `User` model with the following:
```php
use Barchart\Laravel\RememberAll\User as Authenticatable;
class User extends Authenticatable
{
}
```
If you're not extending off of Laravel's base `User` model and instead extending directly off of Eloquent's `Model`, replace Laravel's default `Authenticatable` and `AuthenticatableContract` with the following:
```php
use Barchart\Laravel\RememberAll\EloquentAuthenticatable as Authenticatable;
use Barchart\Laravel\RememberAll\Contracts\Authenticatable as AuthenticatableContract;
class User extends Model implements AuthenticatableContract
{
use Authenticatable;
}
```