Eloquent Model for the sessions table as created by artisan session:table
repat/laravel-database-session-model is a Laravel package for eloquent model for the sessions table as created by artisan session:table.
It currently has 1 GitHub stars and 11.496 downloads on Packagist (latest version 0.5).
Install it with composer require repat/laravel-database-session-model.
Discover more Laravel packages by repat
or browse all Laravel packages to compare alternatives.
Last updated
laravel-database-session-model contains an Eloquent model for the sesssions (or config('sessions.table')) as created by the artisan commands sessions:table
$ composer require repat/laravel-database-session-model
The attribute unserialized_payload returns the payload array, unserialized and base64 decoded. For more information, see the Laravel Documentation on Eloquent Mutators.
The attribute last_activity_at parses the last_activity as a UNIX timestamp.
If you've kept the standard FQCN for Laravels User Model (\App\Model\User::class) you can use the ->user relationship or extend this model and override the user() method.
$session = \Repat\LaravelSessions\Session::first();
// UUID
$session->id; // string
// User
$session->user_id;
$session->user; // App\Models\User, extend the relationship if you have a different FQCN
$session->ip_address; // string
$session->user_agent; // string
// Attributes
$session->unserialized_payload; // array
$session->last_activity_at; // \Carbon\Carbon