option('days') ?? config('bagistoapi.audit.retention_days'); if ($days === null || ! is_numeric($days)) { $this->info('No retention period configured (bagistoapi.audit.retention_days is null). Nothing pruned.'); return self::SUCCESS; } $cutoff = now()->subDays((int) $days); $deleted = AdminApiAudit::where('created_at', '<', $cutoff)->delete(); $this->info("Pruned {$deleted} audit row(s) older than {$days} day(s)."); return self::SUCCESS; } }