52 lines
1.1 KiB
PHP
52 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\BaseModel;
|
|
|
|
class PlacementScore extends BaseModel
|
|
{
|
|
protected $table = 'placement_scores';
|
|
|
|
// ✅ CI: useTimestamps = true (created_at/updated_at)
|
|
public $timestamps = true;
|
|
|
|
protected $fillable = [
|
|
'batch_id',
|
|
'student_id',
|
|
'score',
|
|
'created_by',
|
|
'updated_by',
|
|
'created_at',
|
|
'updated_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'batch_id' => 'integer',
|
|
'student_id' => 'integer',
|
|
'score' => 'decimal:2', // change to 'integer' if score is whole number
|
|
'created_by' => 'integer',
|
|
'updated_by' => 'integer',
|
|
];
|
|
|
|
/* Optional relationships */
|
|
public function batch()
|
|
{
|
|
return $this->belongsTo(PlacementBatch::class, 'batch_id');
|
|
}
|
|
|
|
public function student()
|
|
{
|
|
return $this->belongsTo(Student::class, 'student_id');
|
|
}
|
|
|
|
public function creator()
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
|
|
public function updater()
|
|
{
|
|
return $this->belongsTo(User::class, 'updated_by');
|
|
}
|
|
} |