Primo commit

This commit is contained in:
Francesco Picone
2026-04-05 19:26:04 +02:00
commit 701f479b7f
135 changed files with 21445 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Spatie\Activitylog\Models\Activity;
use App\Models\Setting;
class AuditCleanup extends Command
{
protected $signature = 'audit:cleanup';
protected $description = 'Delete audit log entries older than the configured retention period';
public function handle(): int
{
$retentionDays = Setting::instance()->audit_retention_days ?? 365;
$cutoff = now()->subDays($retentionDays);
$deleted = Activity::where('created_at', '<', $cutoff)->delete();
$this->info("Deleted {$deleted} audit entries older than {$retentionDays} days.");
return self::SUCCESS;
}
}