PHP code example of areia-lab / laravel-login-notifier

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

    

areia-lab / laravel-login-notifier example snippets


return [
    'notify_user' => env('LOGIN_NOTIFIER_NOTIFY_USER', true),

    // Email address to receive admin notifications
    'notify_admin' => env('LOGIN_NOTIFIER_NOTIFY_ADMIN', true),
    'admin_email' => env('LOGIN_NOTIFIER_ADMIN_EMAIL', '[email protected]'),

    'secure_url' => env('LOGIN_NOTIFIER_SECURE_URL', 'forgot-password'),
];

use Illuminate\Support\Facades\Auth;

Auth::attempt(['email' => '[email protected]', 'password' => 'password']);

use AreiaLab\LoginNotifier\Facades\LoginHistory;

// Get all login histories
$all = LoginHistory::getAllHistories();

// Get recent 10 logins
$recent = LoginHistory::getRecentHistories(10);

// Get all logins for a specific user
$userLogins = LoginHistory::getUserHistories($userId);

// Get last login of a user
$lastLogin = LoginHistory::getLastLoginForUser($userId);

// Get logins from new devices for a user
$newDeviceLogins = LoginHistory::getNewDeviceLoginsForUser($userId);
bash
php artisan vendor:publish --tag=login-notifier-config
php artisan vendor:publish --tag=login-notifier-migrations

php artisan migrate