PHP code example of keyshang / laravel-authentication-log

1. Go to this page and download the library: Download keyshang/laravel-authentication-log 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/ */

    

keyshang / laravel-authentication-log example snippets


use Illuminate\Notifications\Notifiable;
use KeyShang\AuthenticationLog\AuthenticationLogable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use Notifiable, AuthenticationLogable;
}

User::find(1)->authentications;

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

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

auth()->user()->previousLoginAt();

auth()->user()->previousLoginIp();

Route::get('/notification', function () {
    $log = \KeyShang\AuthenticationLog\AuthenticationLog::first();
    $user = $log->authenticatable;
    return (new \KeyShang\AuthenticationLog\Notifications\NewDevice($log))
        ->toMail($user);
});