<?php

namespace App\Models;

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

class QuizStudent extends Model
{
    use HasFactory, SoftDeletes;

    protected $table = 'quiz_students';

    protected $fillable = [
        'quiz_id', 'student_register_id'
    ];
    
    protected $casts = [
        'quiz_id' => 'integer',
        'student_register_id' => 'integer',
    ];

    public function quiz()
    {
        return $this->belongsTo(Quiz::class)->withTrashed();
    }

    public function student()
    {
        return $this->belongsTo(StudentRegister::class, 'student_register_id', 'id');
    }
}
