option('period'); $chunkSize = (int) $this->option('chunk'); $skipIndex = (bool) $this->option('skip-index'); $periods = $period === 'all' ? ['24h', '7d'] : [$period]; foreach ($periods as $p) { if (! in_array($p, ['24h', '7d'], true)) { $this->error("Invalid period '{$p}'. Use 24h, 7d, or all."); return self::FAILURE; } $this->info("Recalculating trending ({$p}) …"); $start = microtime(true); $updated = $this->trending->recalculate($p, $chunkSize); $elapsed = round(microtime(true) - $start, 2); $this->info(" ✓ {$updated} artworks updated in {$elapsed}s"); if (! $skipIndex) { $this->info(" Dispatching Meilisearch index jobs …"); $this->trending->syncToSearchIndex($p); $this->info(" ✓ Index jobs dispatched"); } } return self::SUCCESS; } }