PHP code example of salfade / laravel-login-tracker

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

    

salfade / laravel-login-tracker example snippets


    use Salfade\LoginTracker\Traits\HasLoginAttempts;
bash
php artisan vendor:publish --provider="Salfade\LoginTracker\LoginTrackerServiceProvider" --tag="migrations"
php artisan migrate
 php
$userLastSuccessfulLogin = User::find($id)->latestLoginAttempt();
echo $userLastSuccessfulLogin->ip_address;
echo $userLastSuccessfulLogin->created_at;
 php
$userLastSuccessfulLogin = User::find($id)->loginAttempts();
 php
$userLastSuccessfulLogin = User::find($id)->lastLoginIp();
 php
$userLastSuccessfulLogin = User::find($id)->lastLoginDate();
 php
$userLastSuccessfulLogin = User::find($id)->lastLoginDateForHuman();