64 lines
1.4 KiB
PHP
64 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 TeachingArrangement extends Model
|
|
{
|
|
protected $fillable = [
|
|
'teacher_id',
|
|
'subject_id',
|
|
'weekday',
|
|
'start_time',
|
|
'duration_minutes',
|
|
'is_group',
|
|
'max_students',
|
|
'location_id',
|
|
'fee_policy',
|
|
'active',
|
|
];
|
|
|
|
/**
|
|
* The teacher running this arrangement.
|
|
*/
|
|
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');
|
|
}
|
|
|
|
/**
|
|
* Where the session takes place (room, online, etc.)
|
|
*/
|
|
public function location(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Location::class, 'location_id');
|
|
}
|
|
|
|
/**
|
|
* Students assigned to this arrangement.
|
|
*/
|
|
public function students(): HasMany
|
|
{
|
|
return $this->hasMany(TeachingArrangementStudent::class, 'teaching_arrangement_id');
|
|
}
|
|
|
|
/**
|
|
* Attendance records generated from this arrangement.
|
|
*/
|
|
public function attendance(): HasMany
|
|
{
|
|
return $this->hasMany(LessonAttendance::class, 'teaching_arrangement_id');
|
|
}
|
|
}
|