45 lines
1.0 KiB
PHP
45 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\BaseModel;
|
|
|
|
class Exam extends BaseModel
|
|
{
|
|
protected $table = 'exams';
|
|
|
|
/**
|
|
* Your CI model only uses created_at (updatedField = '').
|
|
* In Laravel, easiest is to disable timestamps and manage created_at yourself OR
|
|
* enable timestamps but disable UPDATED_AT.
|
|
*
|
|
* We'll keep auto created_at, no updated_at:
|
|
*/
|
|
public $timestamps = true;
|
|
const UPDATED_AT = null; // ✅ no updated_at column
|
|
|
|
protected $fillable = [
|
|
'student_id',
|
|
'school_id',
|
|
'class_section_id',
|
|
'exam_name',
|
|
'created_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'student_id' => 'integer',
|
|
'school_id' => 'integer',
|
|
'class_section_id' => 'integer',
|
|
];
|
|
|
|
/* Optional relationships */
|
|
public function student()
|
|
{
|
|
return $this->belongsTo(Student::class, 'student_id');
|
|
}
|
|
|
|
public function classSection()
|
|
{
|
|
return $this->belongsTo(ClassSection::class, 'class_section_id');
|
|
}
|
|
} |