xt/laravel-login-history

v1.0.4 2022-11-07 12:48 UTC

This package is auto-updated.

Last update: 2024-11-07 17:52:57 UTC


README

Latest Version on Packagist Total Downloads

Store login history of user (ip, region, country, user agent).

Installation

You can install the package via composer:

composer require xt/laravel-login-history

Run Migrations

Publish the migrations with this artisan command:

php artisan vendor:publish --tag=laravel-login-history-migrations

Configuration

You can publish the config file with this artisan command:

php artisan vendor:publish --tag=laravel-login-history-config

Usage

use Xt\LoginHistory\Traits\HasLoginHistory;

class User extends Model
{
    use HasLoginHistory;
}

After successful login

Call following function after user login successfully

use \Illuminate\Support\Facades\Auth;

Auth::user()->addLoginHistory();

IpInfo API token

get api token from ipinfo.io and add it to your .env file

IPINFO_API_TOKEN=xxxxxx

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email hiren.reshamwala@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.