PHP code example of lopatin96 / laravel-user-online

1. Go to this page and download the library: Download lopatin96/laravel-user-online 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/ */

    

lopatin96 / laravel-user-online example snippets


php artisan migrate

protected $middlewareGroups = [
    …
    \Atin\LaravelUserOnline\Http\Middleware\LastUserActivity::class,
];


use Atin\LaravelUserOnline\Traits\HasOnline;

class User extends Authenticatable
{
    use HasOnline, …
  
protected $casts = [
    …
    'last_seen_at' => 'datetime',
];

auth->user()->isOnline();

php artisan vendor:publish --tag="laravel-user-online-migrations"

php artisan vendor:publish --tag="laravel-user-online-config"