BookTitleResource.php 886 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace App\Http\Resources;
  3. use App\Http\Controllers\BookTitleController;
  4. use Illuminate\Http\Request;
  5. use Illuminate\Http\Resources\Json\JsonResource;
  6. class BookTitleResource extends JsonResource
  7. {
  8. /**
  9. * Transform the resource into an array.
  10. *
  11. * book / paragraph / sn / title 是 book_titles 表列,toc / tags / related_name
  12. * 由 {@see BookTitleController::index} 在取数时附加,
  13. * language 来自目录数据(接口可能不返回)。
  14. *
  15. * @param Request $request
  16. * @return array{
  17. * book: int,
  18. * paragraph: int,
  19. * sn: int,
  20. * title: string,
  21. * toc: string|null,
  22. * tags: string[],
  23. * related_name: string|null,
  24. * language?: string|null
  25. * }
  26. */
  27. public function toArray($request)
  28. {
  29. return parent::toArray($request);
  30. }
  31. }