Added Device and UserIp models and migrations to store device fingerprints and user IPs with expiration. Updated ShowSavingIp Livewire component and view to capture and persist both IP and device fingerprint. Introduced a scheduled command to clean expired user IPs and registered it in the console kernel. Removed the old migration for storing IPs directly on the users table.
19 lines
441 B
PHP
19 lines
441 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use Illuminate\Console\Command;
|
|
use App\Models\UserIp;
|
|
|
|
class CleanExpiredUserIps extends Command
|
|
{
|
|
protected $signature = 'userips:clean';
|
|
protected $description = 'Elimina las IPs de usuario expiradas (más de 12h)';
|
|
|
|
public function handle()
|
|
{
|
|
$count = UserIp::where('expires_at', '<', now())->delete();
|
|
$this->info("Se eliminaron {$count} IPs expiradas.");
|
|
}
|
|
}
|