<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Exam extends Model
{
    protected $fillable = ['school_id', 'term_id', 'name', 'type', 'weight', 'start_date', 'end_date', 'is_published'];
    protected $casts = ['is_published' => 'boolean', 'start_date' => 'date', 'end_date' => 'date', 'weight' => 'decimal:2'];

    public function school() { return $this->belongsTo(School::class); }
    public function term() { return $this->belongsTo(Term::class); }
    public function marks() { return $this->hasMany(Mark::class); }
}
