From 10061d7c65ec835204cbfcb87b7e67ec2153bd2f Mon Sep 17 00:00:00 2001 From: Lizandro Date: Sun, 19 Jul 2026 23:03:12 +0000 Subject: [PATCH] =?UTF-8?q?feat:=20limpieza=20autom=C3=A1tica=20de=20compr?= =?UTF-8?q?obantes=20con=20m=C3=A1s=20de=207=20d=C3=ADas=20(schedule=20dia?= =?UTF-8?q?rio)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Console/Kernel.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index aa365e1..38a52be 100755 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -40,6 +40,17 @@ class Kernel extends ConsoleKernel // $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(); + // Eliminar comprobantes de pago con más de 7 días + $schedule->call(function () { + $dir = storage_path('app/public/comprobantes'); + if (! is_dir($dir)) return; + foreach (glob($dir . '/*') as $file) { + if (is_file($file) && filemtime($file) < strtotime('-7 days')) { + @unlink($file); + } + } + })->daily(); + $schedule->command('tarea:validarCompra')->everyFiveMinutes();