reconstruction of the project
This commit is contained in:
+30
-3
@@ -2,11 +2,22 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\BaseModel;
|
||||
|
||||
class Exam extends Model
|
||||
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 = false;
|
||||
const UPDATED_AT = null; // ✅ no updated_at column
|
||||
|
||||
protected $fillable = [
|
||||
'student_id',
|
||||
'student_school_id',
|
||||
@@ -14,5 +25,21 @@ class Exam extends Model
|
||||
'exam_name',
|
||||
'created_at',
|
||||
];
|
||||
public $timestamps = false;
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user