line(''); $this->line('Checking MySQL...'); try { $t = microtime(true); $result = DB::select('SELECT 1 AS ok'); $ms = round((microtime(true) - $t) * 1000, 1); if ($result && $result[0]->ok === 1) { $this->line(" ✓ Connected ({$ms}ms)"); if ($this->option('detail')) { $ver = DB::select('SELECT VERSION() AS v'); $this->line(' Version: ' . ($ver[0]->v ?? '?')); $pool = config('database.connections.mysql.pool'); $this->line(' Pool max_connections: ' . ($pool['max_connections'] ?? '?')); $this->line(' Pool heartbeat: ' . ($pool['heartbeat'] ?? '?')); $this->line(' Pool max_idle_time: ' . ($pool['max_idle_time'] ?? '?')); } } else { $this->line(' ✗ Unexpected response from SELECT 1'); $allOk = false; } } catch (Throwable $e) { $this->line(' ✗ ' . $e->getMessage()); $allOk = false; } // ── Redis ───────────────────────────────────────────────────────────── $this->line(''); $this->line('Checking Redis...'); try { $t = microtime(true); $pong = Redis::ping(); $ms = round((microtime(true) - $t) * 1000, 1); $this->line(" ✓ PING → {$pong} ({$ms}ms)"); if ($this->option('detail')) { $info = Redis::info(); $this->line(' Version: ' . ($info['redis_version'] ?? '?')); $this->line(' Used memory: ' . ($info['used_memory_human'] ?? '?')); $this->line(' Connected clients: ' . ($info['connected_clients'] ?? '?')); } } catch (Throwable $e) { $this->line(' ✗ ' . $e->getMessage()); $allOk = false; } // ── Summary ─────────────────────────────────────────────────────────── $this->line(''); if ($allOk) { $this->info('All connections OK.'); return 0; } $this->error('One or more connections FAILED. Check the errors above.'); return 1; } }