ChatMessageResource.php 965 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace App\Http\Resources;
  3. use Illuminate\Contracts\Support\Arrayable;
  4. use Illuminate\Http\Request;
  5. use Illuminate\Http\Resources\Json\JsonResource;
  6. class ChatMessageResource extends JsonResource
  7. {
  8. /**
  9. * Transform the resource into an array.
  10. *
  11. * @param Request $request
  12. * @return array|Arrayable|\JsonSerializable
  13. */
  14. public function toArray($request)
  15. {
  16. return [
  17. 'id' => $this->uid,
  18. 'chat_id' => $this->chat_id,
  19. 'parent_id' => $this->parent_id,
  20. 'session_id' => $this->session_id,
  21. 'role' => $this->role,
  22. 'content' => $this->content,
  23. 'model_name' => $this->model_name,
  24. 'tool_calls' => $this->tool_calls,
  25. 'tool_call_id' => $this->tool_call_id,
  26. 'is_active' => $this->is_active,
  27. 'created_at' => $this->created_at,
  28. 'updated_at' => $this->updated_at,
  29. ];
  30. }
  31. }