A simple package to track users successful login attempts
salfade/laravel-login-tracker is a Laravel package for a simple package to track users successful login attempts.
It currently has 4 GitHub stars and 2.126 downloads on Packagist (latest version 0.0.8).
Install it with composer require salfade/laravel-login-tracker.
Discover more Laravel packages by salfade
or browse all Laravel packages to compare alternatives.
Last updated
This simple package let's you track your user login activity. Track their IPs to give you better visibility to see user activity.
composer require salfade/laravel-login-tracker
Publish and run the migrations with:
php artisan vendor:publish --provider="Salfade\LoginTracker\LoginTrackerServiceProvider" --tag="migrations"
php artisan migrate
Next, add the Salfade\LoginTracker\Traits\HasLoginAttempts trait to your User Model.
use Salfade\LoginTracker\Traits\HasLoginAttempts;
Retrieving the latest successful login attempt
$userLastSuccessfulLogin = User::find($id)->latestLoginAttempt();
echo $userLastSuccessfulLogin->ip_address;
echo $userLastSuccessfulLogin->created_at;
Retrieving all the successful login attempts
$userLastSuccessfulLogin = User::find($id)->loginAttempts();
Retrieving the IP address of last successful login attempt
$userLastSuccessfulLogin = User::find($id)->lastLoginIp();
Retrieving the timestamp of last successful login attempt
$userLastSuccessfulLogin = User::find($id)->lastLoginDate();
Retrieving the human friendly date for last successful login attempt
$userLastSuccessfulLogin = User::find($id)->lastLoginDateForHuman();
composer test
Please see CHANGELOG for more information on what has changed recently.
Please see CONTRIBUTING for details.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.