<?php

namespace App\Models;

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

class RevisionWizard extends Model
{
    use HasFactory;

    protected $table = 'revision_wizards';

    protected $fillable = [
        'teacher_id',
        'teacher_class_id',
        'title',
        'class_id',
        'year',
        'section',
        'subject_id',
        'file',
        'issue_date'
    ];
    
    protected $casts = [
        'teacher_id' => 'integer',
        'teacher_class_id' => 'integer',
        'class_id' => 'integer',
        'subject_id' => 'integer',
    ];

    public function teacher()
    {
        return $this->belongsTo(Teacher::class, 'teacher_id');
    }

    public function teacherClass()
    {
        return $this->belongsTo(TeacherClass::class, 'teacher_class_id');
    }

    public function classRelation()
    {
        return $this->belongsTo(Classes::class, 'class_id')->withTrashed();
    }

    public function subject()
    {
        return $this->belongsTo(Subject::class, 'subject_id')->withTrashed();
    }
}
