json(['status' => 'ok']) ->header('Cache-Control', 'no-store'); } public function ready(): JsonResponse { try { DB::select('select 1'); $key = 'health:'.bin2hex(random_bytes(12)); Cache::put($key, 'ok', 5); $cacheReady = Cache::pull($key) === 'ok'; if (! $cacheReady) { throw new \RuntimeException('Cache read/write check failed.'); } } catch (Throwable $exception) { report($exception); return response() ->json(['status' => 'not_ready'], 503) ->header('Cache-Control', 'no-store'); } return response() ->json(['status' => 'ready']) ->header('Cache-Control', 'no-store'); } }