info('Refreshing KPI data from Google Sheets...'); // Clear existing cache first $kpiService->clearCache(); $this->line('Cache cleared.'); // Fetch fresh data $data = $kpiService->getKpiData(); if ($data['updated_at']) { $this->info('KPI data refreshed successfully!'); $this->table( ['Metric', 'Value'], collect($data['data'])->map(function ($value, $key) { return [ str_replace('_', ' ', ucwords($key, '_')), number_format($value), ]; })->toArray() ); $this->line("Updated at: {$data['updated_at']}"); return Command::SUCCESS; } $this->warn('Failed to fetch fresh data, using default values.'); return Command::FAILURE; } }