| namespace App\Models; | |
| use Illuminate\Database\Eloquent\Factories\HasFactory; | |
| use Illuminate\Database\Eloquent\Model; | |
| use Illuminate\Database\Eloquent\Relations\BelongsTo; | |
| class ChatMessage extends Model | |
| { | |
| use HasFactory; | |
| protected $fillable = [ | |
| 'chat_conversation_id', | |
| 'role', | |
| 'content', | |
| ]; | |
| public function conversation(): BelongsTo | |
| { | |
| return $this->belongsTo(ChatConversation::class, 'chat_conversation_id'); | |
| } | |
| } | |