ChatMessageResource.php 939 B

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