AgentGrantResource.php 713 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. namespace App\Http\Resources\V3;
  3. use App\Services\V3\AgentGrantService;
  4. use Illuminate\Http\Request;
  5. /**
  6. * 一张 agent 写入授权:模型写入时把 token 放进 `X-Agent-Grant` 请求头。
  7. *
  8. * 载荷由 {@see AgentGrantService::issue()} 组好,本类只做形状声明。
  9. */
  10. class AgentGrantResource extends BaseResource
  11. {
  12. /**
  13. * @param Request $request
  14. * @return array{
  15. * token: string,
  16. * grantor: string,
  17. * ai_model: string,
  18. * target_type: string,
  19. * target_id: string,
  20. * book: int,
  21. * expires_at: string
  22. * }
  23. */
  24. public function toArray($request): array
  25. {
  26. return $this->resource;
  27. }
  28. }