option('company'); if ($companyId) { $companies = Company::where('id', $companyId)->pluck('id'); } else { // Only warm companies that actually have products to avoid empty cache entries $companies = Company::whereHas('products')->pluck('id'); } if ($companies->isEmpty()) { $this->warn('No companies found with products to warm cache for.'); return self::SUCCESS; } $this->info("Starting to warm product catalog cache for {$companies->count()} companies..."); $bar = $this->output->createProgressBar($companies->count()); $bar->start(); foreach ($companies as $id) { $catalogService->rebuildCache($id); $bar->advance(); } $bar->finish(); $this->newLine(); $this->info('✅ Product catalog cache warming completed!'); return self::SUCCESS; } }