fomvasss/laravel-last-visit

This package is abandoned and no longer maintained. No replacement package was suggested.

Check last visit user

Installs: 15

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 0

Open Issues: 0

Type:composer-package

1.0.0 2018-08-31 09:10 UTC

This package is auto-updated.

Last update: 2020-08-14 20:49:03 UTC


README

A package for fixing the last visit of an authorized user in the system

Installation

Require this package with composer

composer require fomvasss/laravel-last-visit

Publish package config (if need)

php artisan vendor:publish --provider="Fomvasss\LastVisit\ServiceProvider"

Add middleware to Http/Kernel.php, for example in web group:

    protected $middlewareGroups = [
        'web' => [
            //...
            \Fomvasss\LastVisit\Middleware\LogLastVisitMiddleware::class,
        ],
    ];

Usage

  • Add in your User model next trait: Visitable (Fomvasss\LastVisit\Traits)

  • Use method isOnline()

Example:

$users = User::select('id')->get();
foreach ($user as $user) {
    if ($user->isOnline()) {
        $user->last_visit = \Carbon\Carbon::now();
        $user->save();
    }
}

This code you can use in CRON schedule.