54 lines
1.1 KiB
PHP
54 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class StudentAcademicHistory extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'student_id',
|
|
'academic_year_id',
|
|
'department_id',
|
|
'class_id',
|
|
'status',
|
|
'start_date',
|
|
'end_date',
|
|
'notes',
|
|
'is_current',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'start_date' => 'date',
|
|
'end_date' => 'date',
|
|
'is_current' => 'boolean',
|
|
];
|
|
}
|
|
|
|
public function student(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Student::class);
|
|
}
|
|
|
|
public function academicYear(): BelongsTo
|
|
{
|
|
return $this->belongsTo(AcademicYear::class);
|
|
}
|
|
|
|
public function department(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Department::class);
|
|
}
|
|
|
|
public function classRoom(): BelongsTo
|
|
{
|
|
return $this->belongsTo(SchoolClass::class, 'class_id');
|
|
}
|
|
}
|