Files
alrahma_sunday_school_api/app/Models/CompetitionScore.php
T
2026-06-08 23:45:55 -04:00

44 lines
1009 B
PHP

<?php
namespace App\Models;
use App\Models\BaseModel;
class CompetitionScore extends BaseModel
{
protected $table = 'competition_scores';
// ✅ legacy: useTimestamps = true (created_at/updated_at)
public $timestamps = true;
protected $fillable = [
'competition_id',
'student_id',
'class_section_id',
'score',
'notes',
];
protected $casts = [
'competition_id' => 'integer',
'student_id' => 'integer',
'class_section_id' => 'integer',
'score' => 'integer', // change to 'decimal:2' if score is not int
];
/* Optional relationships */
public function competition()
{
return $this->belongsTo(Competition::class, 'competition_id');
}
public function student()
{
return $this->belongsTo(Student::class, 'student_id');
}
public function classSection()
{
return $this->belongsTo(ClassSection::class, 'class_section_id');
}
}