<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class TopicQuestionPart extends Model
{
    use HasFactory;

    protected $fillable = [
        'topic_id',
        'question_id',
        'questionPart',
        'questionMark',
        'questionAnswer'
    ];
    
    protected $casts = [
        'topic_id' => 'integer',
        'question_id' => 'integer',
        'questionMark' => 'integer',
    ];

    public function topic()
    {
        return $this->belongsTo(Topic::class, 'topic_id');
    }

    public function question()
    {
        return $this->belongsTo(TopicQuestion::class, 'question_id');
    }
}
