PHP code example of moecasts / laravel-user-login-log

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

    

moecasts / laravel-user-login-log example snippets


composer 

Moecasts\Laravel\UserLoginLog\UserLoginLogServiceProvider,

return [
    /**
     * cache avtive time (seconds)
     */
    'expire' => 300,
];

use Moecasts\Laravel\UserLoginLog\Traits\LoginLoggable;

class User extends Authenticatable
{
    use LoginLoggable;
}

// app/Http/Kernel.php

class Kernel extends HttpKernel
{
    protected $routeMiddleware = [
        'auth' => \App\Http\Middleware\Authenticate::class,
        // ...
        'login.log' => \Moecasts\Laravel\UserLoginLog\Middleware\UserLoginLogMiddleware::class,
    ];

    // ...
}

Route::get('hello')->middleware(['auth', 'login.log']);

$user = new User;
$user->loginLogs;

$user = new User;
$user->createLoginLog();

$user = new User;
// $user->logLogin($seconds = null)
$user->logLogin();

$user = new User;
$user->isNewLogin();
bash
php artisan vendor:publish --tag=laravel-user-login-log-migrations
bash
php artisan vendor:publish --tag=laravel-user-login-log-config
bash
php artisan migrate