61 lines
1.4 KiB
PHP
61 lines
1.4 KiB
PHP
<?php
|
||
|
||
namespace App\Models;
|
||
|
||
use Illuminate\Database\Eloquent\Model;
|
||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||
|
||
class StudentTeacherSubject extends Model
|
||
{
|
||
protected $fillable = [
|
||
'student_id',
|
||
'teacher_id',
|
||
'subject_id',
|
||
'rate_override',
|
||
'status',
|
||
'notes',
|
||
];
|
||
|
||
/**
|
||
* The student this relationship belongs to.
|
||
*/
|
||
public function student(): BelongsTo
|
||
{
|
||
return $this->belongsTo(StudentProfile::class, 'student_id');
|
||
}
|
||
|
||
/**
|
||
* The teacher assigned to this student for this subject.
|
||
*/
|
||
public function teacher(): BelongsTo
|
||
{
|
||
return $this->belongsTo(TeacherProfile::class, 'teacher_id');
|
||
}
|
||
|
||
/**
|
||
* The subject being taught.
|
||
*/
|
||
public function subject(): BelongsTo
|
||
{
|
||
return $this->belongsTo(Subject::class, 'subject_id');
|
||
}
|
||
|
||
/**
|
||
* Teaching arrangements (sessions/timetabled slots)
|
||
* linking this student–teacher subject pair to actual classes.
|
||
*/
|
||
public function teachingArrangements(): HasMany
|
||
{
|
||
return $this->hasMany(TeachingArrangementStudent::class);
|
||
}
|
||
|
||
/**
|
||
* Attendance records for this student–teacher–subject combination.
|
||
*/
|
||
public function attendance(): HasMany
|
||
{
|
||
return $this->hasMany(LessonAttendance::class);
|
||
}
|
||
}
|