Implement device and IP tracking for users
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.
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
<?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.");
|
||||
}
|
||||
}
|
||||
@@ -30,11 +30,13 @@ class Kernel extends ConsoleKernel
|
||||
|
||||
protected function schedule(Schedule $schedule)
|
||||
{
|
||||
$schedule->command('userips:clean')->hourly();
|
||||
|
||||
// $schedule->exec('nohup php /home/u111286300/domains/sirpremium.com.co/public_html/app/artisan queue:work --sleep=3 --tries=3 > /dev/null 2>&1 &')->everyMinute();
|
||||
|
||||
|
||||
// $schedule->exec('nohup php /var/www/sirpremium/artisan queue:work --sleep=3 --tries=3 > /dev/null 2>&1 &')->everyMinute();
|
||||
$schedule->command('telescope:prune --hours=24')->daily();
|
||||
|
||||
|
||||
$schedule->command('tarea:validarCompra')->everyFiveMinutes();
|
||||
|
||||
|
||||
@@ -100,10 +102,10 @@ class Kernel extends ConsoleKernel
|
||||
//curl_close($curl);
|
||||
//return $response;
|
||||
// if ($err) {
|
||||
//
|
||||
//
|
||||
|
||||
//} else {
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user