<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class StudentClass extends Model
{
    protected $fillable = ['name', 'level', 'homeroom_teacher_id'];

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

    public function students()
    {
        return $this->hasMany(Student::class);
    }

    public function modules()
    {
        return $this->belongsToMany(
            Module::class,
            'modules_student_class',
            'student_class_id',
            'module_id'
        );
}
}

