HeartbeatV3Resource.php 695 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Http\Request;
  4. class HeartbeatV3Resource extends V3Resource
  5. {
  6. /**
  7. * 心跳结果。
  8. *
  9. * status 目前只有 'ok' 一个取值——被停机时走 503 的 Problem Details 分支,
  10. * 不会到这里。注意这里不含任何依赖项的健康状态,那是 health-check 的职责。
  11. *
  12. * @param Request $request
  13. * @return array{
  14. * status: string,
  15. * checked_at: string
  16. * }
  17. */
  18. public function toArray($request): array
  19. {
  20. return [
  21. 'status' => $this->resource['status'],
  22. 'checked_at' => $this->resource['checked_at'],
  23. ];
  24. }
  25. }