neoban/backend/app/Models/ChatMessage.php
kushal-saha d818c5f05d refactor(core): restructure chat models and services, integrate route-based chat IDs
- Updated `Chat` and `ChatMessage` models for new table structures with UUIDs and attributes.
- Integrated `ChatPolicy` for authorization checks.
- Updated `ChatMessageController` with authorization and refined logic.
- Adjusted routes and state in the frontend to handle chat IDs from the URL.
- Enhanced `SocialMediaService` for handling chat-specific user prompts.
- Removed unused migrations related to chats and chat messages.
2026-04-29 15:36:56 +00:00

22 lines
645 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Attributes\Table;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
#[Fillable(['conversation_id', 'agent_id', 'role', 'content', 'attachment', 'tool_calls', 'tool_results', 'usage', 'meta', 'content', 'user_id'])]
#[Table('agent_conversation_messages')]
class ChatMessage extends Model
{
use HasUuids;
public function chat(): BelongsTo
{
return $this->belongsTo(Chat::class, 'conversation_id', 'id');
}
}