Package Data | |
---|---|
Maintainer Username: | GabrielDeveloper |
Maintainer Contact: | gabrielll_07@hotmail.com (Gabriel Goncalves) |
Package Create Date: | 2016-04-13 |
Package Last Update: | 2023-04-19 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-19 03:16:42 |
Package Statistics | |
---|---|
Total Downloads: | 92,386 |
Monthly Downloads: | 1,355 |
Daily Downloads: | 47 |
Total Stars: | 198 |
Total Watchers: | 7 |
Total Forks: | 43 |
Total Open Issues: | 7 |
Laravel | Package :-------------|:---------- 5.5.x | 2.3.x 5.4.x | 2.2.x 5.3.x | 2.0.x 5.2.x | 1.0.x
Add the new required package in your composer.json
"highideas/laravel-users-online": "^2.3"
Run composer update
or php composer.phar update
.
Or install directly via composer
composer require highideas/laravel-users-online
After composer command, add new middleware in app/Http/Kernel.php
:
\HighIdeas\UsersOnline\Middleware\UsersOnline::class,
After this, add the trait in your model User in app/User.php
:
class User extends Authenticatable
{
use \HighIdeas\UsersOnline\Traits\UsersOnlineTrait;
...
Finally run php artisan vendor:publish
for add the namespaces
For show the users online just use the method allOnline()
:
$user = new User;
$user->allOnline();
Or if you want to check if a specific user is online use the method isOnline()
:
$user = User::find($id);
$user->isOnline();
You can sort all users online with the methods mostRecentOnline()
and leastRecentOnline()
:
$user = new User;
$user->mostRecentOnline();
$user->leastRecentOnline();
Installation and usage on last versions of framework: