reconstruction of the project
This commit is contained in:
@@ -6,11 +6,11 @@ use App\Models\BaseModel;
|
||||
|
||||
class InvoiceStudentList extends BaseModel
|
||||
{
|
||||
// Specify the table name
|
||||
protected $table = 'invoice_students_list'; // Primary key for the table
|
||||
protected $primaryKey = 'id';
|
||||
protected $table = 'invoice_students_list';
|
||||
|
||||
// ✅ CI: useTimestamps = true (created_at/updated_at)
|
||||
public $timestamps = true;
|
||||
|
||||
// Specify which fields are allowed for mass assignment
|
||||
protected $fillable = [
|
||||
'invoice_id',
|
||||
'student_id',
|
||||
@@ -24,15 +24,21 @@ class InvoiceStudentList extends BaseModel
|
||||
'semester',
|
||||
];
|
||||
|
||||
// Enable auto-incrementing primary key
|
||||
protected $useAutoIncrement = true;
|
||||
protected $casts = [
|
||||
'invoice_id' => 'integer',
|
||||
'student_id' => 'integer',
|
||||
'school_id' => 'integer',
|
||||
'enrolled' => 'boolean',
|
||||
];
|
||||
|
||||
// Specify return type as an array
|
||||
/* Optional relationships */
|
||||
public function invoice()
|
||||
{
|
||||
return $this->belongsTo(Invoice::class, 'invoice_id');
|
||||
}
|
||||
|
||||
// Automatically set `created_at` and `updated_at` fields
|
||||
public $timestamps = true;
|
||||
|
||||
// Specify the names of the timestamp fields
|
||||
const CREATED_AT = 'created_at';
|
||||
const UPDATED_AT = 'updated_at';
|
||||
}
|
||||
public function student()
|
||||
{
|
||||
return $this->belongsTo(Student::class, 'student_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user