ryancco/laravel-sessions is a Laravel package for the missing model for laravel sessions.
It currently has 0 GitHub stars and 3 downloads on Packagist (latest version 0.1).
Install it with composer require ryancco/laravel-sessions.
Discover more Laravel packages by ryancco
or browse all Laravel packages to compare alternatives.
Last updated
The missing model for Laravel sessions with some conveniently opinionated functionality built-in.
Laravel Sessions can be installed via Composer.
composer require ryancco/laravel-sessions
class User extends Authenticatable
{
use \Ryancco\Sessions\HasSessions;
@method active(Carbon|int $last_activity = 60)
$user->sessions()
->active(30) // active in the last 30 minutes
->get();
@method inactive(Carbon|int $last_activity = 60)
$user->sessions()->inactive(
now()->subHours(2) // not active in the last 2 hours
)->get();
Currently, this package leverages jenssegers/agent for device information. Check out the pieces used and head over to that repository for any further information.
$device = $user->sessions()
->latest('last_activity')
->first()
->device();
$device->device();
$device->browser();
$device->platform();
$device->browserVersion();
$device->platformVersion();
Laravel Sessions expects you to be using Laravel's database session driver. To learn more about this and other session driver preqrequisites, check out the documentation.
Please report any problems by creating an issue. Pull requests are always welcomed.