PHP code example of aginev / login-activity

1. Go to this page and download the library: Download aginev/login-activity 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/ */

    

aginev / login-activity example snippets


// config/app.php

'providers' => [
    '...',
    Aginev\LoginActivity\LoginActivityServiceProvider::class,
];

// app/Console/Kernel.php

protected $commands = [
    '...',
    \Aginev\LoginActivity\Commands\LoginActivityClean::class,
];

$logs = \LoginActivity::getLogs()->get();

$logs = \LoginActivity::getLatestLogs(100); // number of logs to get or leave empty if you want to use the config value

$logs = \LoginActivity::getLoginLogs()->get();

$logs = \LoginActivity::getLatestLoginLogs(100); // number of logs to get or leave empty if you want to use the config value

$logs = \LoginActivity::getLogoutLogs()->get();

$logs = \LoginActivity::getLatestLogoutLogs(100); // number of logs to get or leave empty if you want to use the config value

$logs = \LoginActivity::cleanLog(30); // Offset in days
sh
php artisan vendor:publish --provider="Aginev\LoginActivity\LoginActivityServiceProvider" --tag="migrations"
php artisan migrate
sh
php artisan vendor:publish --provider="Aginev\LoginActivity\LoginActivityServiceProvider" --tag="config"
sh
php artisan login-activity:clean