reconstruction of the project
This commit is contained in:
@@ -2,11 +2,15 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\BaseModel;
|
||||
|
||||
class CompetitionScore extends Model
|
||||
class CompetitionScore extends BaseModel
|
||||
{
|
||||
protected $table = 'competition_scores';
|
||||
|
||||
// ✅ CI: useTimestamps = true (created_at/updated_at)
|
||||
public $timestamps = true;
|
||||
|
||||
protected $fillable = [
|
||||
'competition_id',
|
||||
'student_id',
|
||||
@@ -16,5 +20,27 @@ class CompetitionScore extends Model
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
public $timestamps = true;
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user