PHP code example of fomvasss / laravel-last-visit

1. Go to this page and download the library: Download fomvasss/laravel-last-visit library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fomvasss / laravel-last-visit example snippets


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

$users = User::select('id')->get();
foreach ($user as $user) {
    if ($user->isOnline()) {
        $user->last_visit = \Carbon\Carbon::now();
        $user->save();
    }
}
shell
php artisan vendor:publish --provider="Fomvasss\LastVisit\ServiceProvider"