<?php

namespace App\Models;

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

class ExamResult extends Model
{
  use HasFactory;

  protected $table = 'exam_results';

  protected $fillable = [
    'result',
    'remarks',
    'student_id',
    'teacher_id',
    'exam_id',
  ];

  public function exams()
  {
    return $this->belongsToMany(
      'App\Models\Exam',
      'exam_exam_result_rel',
      'exam_id',
      'exam_result_id'
    );
  }

  public function student()
  {
    return $this->belongsTo('App\Models\Student');
  }

  public function teacher()
  {
    return $this->belongsTo('App\Models\Teacher');
  }

  public function exam()
  {
    return $this->belongsTo('App\Models\Exam');
  }
}
