PHP code example of xetaio / xetaravel-iptraceable

1. Go to this page and download the library: Download xetaio/xetaravel-iptraceable 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/ */

    

xetaio / xetaravel-iptraceable example snippets


return [
    // ...
    Xetaio\IpTraceable\Providers\IpTraceableServiceProvider::class,
];

->withMiddleware(function (Middleware $middleware) {
    $middleware->web(append: [
        \Xetaio\IpTraceable\Http\Middleware\IpTraceable::class,
    ]);
})

return [
    'fields' => [
        'last_login_ip' => 'last_login_ip',   // Column name for the IP address
        'last_login_date' => null,               // Set a column name to enable, or null to disable
    ],
];

$table->ipAddress('last_login_ip')->nullable();
$table->dateTime('last_login_date')->nullable(); // Optional — enable in config
bash
php artisan vendor:publish --provider="Xetaio\IpTraceable\Providers\IpTraceableServiceProvider" --tag=config