This package will subscribe for login and logout events and will log data into database or log files.
- Composer installable
- PSR4 auto loading
- Track user login
- Track user logout
- Write logs in database or log files
- Command for cleaning logs
Build only for Laravel Framework 5 only!
In terminal
composer require aginev/login-activity:1.0.*Add Service Provider to your config/app.php like so
// config/app.php
'providers' => [
'...',
Aginev\LoginActivity\LoginActivityServiceProvider::class,
];Publish migrations
php artisan vendor:publish --provider="Aginev\LoginActivity\LoginActivityServiceProvider" --tag="migrations"
php artisan migrateOptionally you can add login activity command and you will be able to clean your logs.
// app/Console/Kernel.php
protected $commands = [
'...',
\Aginev\LoginActivity\Commands\LoginActivityClean::class,
];Optionally publish config
php artisan vendor:publish --provider="Aginev\LoginActivity\LoginActivityServiceProvider" --tag="config"Get logs
$logs = \LoginActivity::getLogs()->get();Get latest logs
$logs = \LoginActivity::getLatestLogs(100); // number of logs to get or leave empty if you want to use the config valueGet login logs
$logs = \LoginActivity::getLoginLogs()->get();Get latest login logs
$logs = \LoginActivity::getLatestLoginLogs(100); // number of logs to get or leave empty if you want to use the config valueGet logout logs
$logs = \LoginActivity::getLogoutLogs()->get();Get latest logout logs
$logs = \LoginActivity::getLatestLogoutLogs(100); // number of logs to get or leave empty if you want to use the config valueClean log
$logs = \LoginActivity::cleanLog(30); // Offset in daysClean the log from terminal
php artisan login-activity:clean- Implement \Aginev\LoginActivity\Handlers\LogActivityInterface in your custom handler.
- Place custom handler as value in login-activity.log config