<?php

namespace App\Models;

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

class TeacherClassStudent extends Model
{
    use HasFactory;

    protected $table = 'teacher_class_students';

    protected $fillable = [
        'teacher_id',
        'teacher_class_id',
        'student_id',
    ];
    
    protected $casts = [
        'teacher_id' => 'integer',
        'teacher_class_id' => 'integer',
        'student_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 students()
    {
        return $this->belongsTo(Student::class, 'student_id','id');
    }
}
