Initial commit

This commit is contained in:
Richard Jolley committed 2026-01-14 00:54:08 +00:00
commit c909d539bc
7178 files changed
+756624

No files matched your search

+59
View File
@@ -0,0 +1,59 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
class TeacherProfile extends Model
{
// Which attributes can be mass-assigned (used in ::create([...]))
protected $fillable = [
'user_id',
'bio',
'picture',
'location',
'hourly_rate',
'qualifications',
'active',
];
/**
* Link back to the user this profile belongs to
*/
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
/**
* Subjects this teacher teaches
*/
public function subjects(): BelongsToMany
{
return $this->belongsToMany(Subject::class, 'level_subject_teacher')
->withPivot('level_id'); // since we’re also tracking level
}
/**
* Levels this teacher teaches
*/
public function levels(): BelongsToMany
{
return $this->belongsToMany(Level::class, 'level_subject_teacher')
->withPivot('subject_id');
}
public function teachingArrangements(): HasMany
{
return $this->hasMany(TeachingArrangement::class, 'teacher_id');
}
public function payPeriods(): HasMany
{
return $this->hasMany(TeacherPayPeriod::class, 'teacher_id');
}
}