neoban/backend/app/Data/Chats/ChatResponseDto.php
kushal-saha cde80dbf08 refactor(core): restructure namespaces for chat-related requests, resources, and responses
- Moved chat-related controllers, resources, requests, and DTOs into their respective `Chats` namespaces.
- Updated route imports to reflect new namespace structure.
2026-04-29 15:39:44 +00:00

29 lines
635 B
PHP

<?php
namespace App\Data\Chats;
use App\Models\Chat;
use Carbon\CarbonInterface;
final readonly class ChatResponseDto
{
public function __construct(
public string $id,
public CarbonInterface $createdAt,
public CarbonInterface $updatedAt,
public string $userId,
public ?string $title = null,
) {}
public static function fromModel(Chat $chat)
{
return new self(
id: $chat->id,
createdAt: $chat->created_at,
updatedAt: $chat->updated_at,
userId: $chat->user_id,
title: $chat->title ?? null,
);
}
}