2017 © Pedro Peláez
 

laravel online-users-laravel

Show the users online in your Laravel application

image

tusharthe/online-users-laravel

Show the users online in your Laravel application

  • Sunday, March 25, 2018
  • by tusharthe
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

online-users-laravel

Show the users online in your Laravel application

Instalation

install directly via composer, (*1)

composer require tusharthe/online-users-laravel

After composer command, register service prodiver in app/config/app.php under providers:, (*2)

    tusharthe\OnlineUsers\OnlineUsersServiceProvider::class,

After this, add new middleware in app/Http/Kernel.php :, (*3)

  \tusharthe\OnlineUsers\Middleware\UsersOnline::class,

After this, add the Library (trait) in your model User in app/User.php:, (*4)


class User extends Authenticatable { use \tusharthe\OnlineUsers\Library\OnlineUsers; ... }

After this, add the event in your EventServiceProvider in app/Providers/EventServiceProvider.php under 'protected $listen = ' :, (*5)

NOTE: in laravel 5.5 or above aumatically register event

        'Illuminate\Auth\Events\Logout' => [
            'tusharthe\OnlineUsers\Listeners\LogoutListener',
        ],

Finally run :

php artisan vendor:publish for add the namespaces & select appropriate Provider tusharthe\OnlineUsers\OnlineUsersServiceProvider., (*6)

How To Use:

To get all Online Users just use the method allOnline() Like below:, (*7)

$user = new User;
$user->allOnline();

Or if you want to check if a specific user is online or not use the method isOnline():, (*8)

$user = User::find($id);
$user->isOnline();

You Can also able to to set timming of user in app/config/OnlineUser.php Default 3 min is set., (*9)

Laravel compatibility

   5.4 or above    

The Versions

25/03 2018

dev-master

9999999-dev

Show the users online in your Laravel application

  Sources   Download

MIT

by Tushar Kanti

laravel users

25/03 2018

1.0

1.0.0.0

Show the users online in your Laravel application

  Sources   Download

MIT

by Tushar Kanti

25/03 2018

1.0.x-dev

1.0.9999999.9999999-dev

Show the users online in your Laravel application

  Sources   Download

MIT

by Tushar Kanti