false, 'redis' => false, ]; $overallStatus = true; try { DB::connection()->getPdo(); $checks['database'] = true; } catch (Throwable $e) { Log::error('Health check: Database connection failed', ['exception' => $e->getMessage()]); $overallStatus = false; } try { Redis::ping(); $checks['redis'] = true; } catch (Throwable $e) { Log::error('Health check: Redis connection failed', ['exception' => $e->getMessage()]); $overallStatus = false; } if ($overallStatus) { return response()->json([ 'status' => 'ok', 'dependencies' => $checks, ]); } return response()->json([ 'status' => 'error', 'dependencies' => $checks, ], 503); } }