57 lines
1.4 KiB
PHP
57 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\HasOne;
|
||
|
||
class LessonAttendance extends Model
|
||
{
|
||
protected $fillable = [
|
||
'teaching_arrangement_id',
|
||
'student_teacher_subject_id',
|
||
'scheduled_start',
|
||
'scheduled_end',
|
||
'actual_start',
|
||
'actual_end',
|
||
'week_of_year',
|
||
'status',
|
||
'billable',
|
||
'payable',
|
||
'notes',
|
||
];
|
||
|
||
/**
|
||
* The scheduled arrangement this attendance record belongs to.
|
||
*/
|
||
public function arrangement(): BelongsTo
|
||
{
|
||
return $this->belongsTo(TeachingArrangement::class, 'teaching_arrangement_id');
|
||
}
|
||
|
||
/**
|
||
* The student–teacher–subject relationship for this attendance.
|
||
*/
|
||
public function studentTeacherSubject(): BelongsTo
|
||
{
|
||
return $this->belongsTo(StudentTeacherSubject::class, 'student_teacher_subject_id');
|
||
}
|
||
|
||
/**
|
||
* Invoice item generated from this attendance (if billed).
|
||
*/
|
||
public function invoiceItem(): HasOne
|
||
{
|
||
return $this->hasOne(InvoiceItem::class, 'attendance_id');
|
||
}
|
||
|
||
/**
|
||
* Teacher pay record generated from this attendance (if payable).
|
||
*/
|
||
public function payItem(): HasOne
|
||
{
|
||
return $this->hasOne(TeacherPayItem::class, 'attendance_id');
|
||
}
|
||
}
|