LaravelPackages.net
Acme Inc.
Toggle sidebar
malekk/laravel-auth-log

Laravel package for authentication log

7
1
About malekk/laravel-auth-log

malekk/laravel-auth-log is a Laravel package for laravel package for authentication log. It currently has 1 GitHub stars and 7 downloads on Packagist. Install it with composer require malekk/laravel-auth-log. Discover more Laravel packages by malekk or browse all Laravel packages to compare alternatives.

Last updated

Laravel Authentication Log

Installation

Laravel Authentication Log requires PHP 7.0+.

You may use Composer to install Laravel Authentication Log into your Laravel project:

composer require malekk/laravel-auth-log

Configuration

Once installed, if you are not using automatic package discovery, then you need to register the Malekk\LaravelAuthLog\AuthLogServiceProvider service provider in your config/app.php.

You need to migrate your database, the laravel-auth-log migration will create the table to store authentication logs:

php artisan migrate

Finally, add the AuthenticationLogable trait to your User model (by default, App\Models\User model). The trait provide various methods to allow you to get common authentication log data, such as last login time, last login IP address:

namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Malekk\LaravelAuthLog\Models\AuthenticationLogable;

class User extends Authenticatable
{
    use AuthenticationLogable;
}

Basic Usage

Get all authentication logs for the user:

User::find(1)->authentications;

Get the user last login info:

User::find(1)->lastLoginAt();

User::find(1)->lastLoginIp();

Contributing

Thank you for considering contributing to the laravel-auth-log!

License

Laravel-Auth-Log is open-sourced software licensed under the MIT license.

Star History Chart