2
0

DiscussionCountResource.php 649 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace App\Http\Resources\V3;
  3. use App\Services\V3\DiscussionService;
  4. use Illuminate\Http\Request;
  5. /**
  6. * 一个对象上的讨论角标:未关闭的评论线程数,以及其中当前用户发起的数目。
  7. *
  8. * 载荷由 {@see DiscussionService::batchCount()} 组好,本类只做形状声明。
  9. */
  10. class DiscussionCountResource extends BaseResource
  11. {
  12. /**
  13. * @param Request $request
  14. * @return array{
  15. * target_type: string,
  16. * target_id: string,
  17. * total: int,
  18. * mine: int
  19. * }
  20. */
  21. public function toArray($request): array
  22. {
  23. return $this->resource;
  24. }
  25. }