Files
alrahma_sunday_school_api/app/Models/CurrentFlag.php
T
2026-06-11 11:46:12 -04:00

62 lines
1.5 KiB
PHP

<?php
namespace App\Models;
class CurrentFlag extends BaseModel
{
protected $table = 'current_flag';
// legacy model didn't specify timestamps. Since the table has created_at/updated_at columns,
// you can enable auto-management. If your table does NOT actually have them, set false.
public $timestamps = true;
protected $fillable = [
'student_id',
'student_name',
'grade',
'flag',
'flag_datetime',
'flag_state',
'updated_by_open',
'open_description',
'updated_by_closed',
'close_description',
'action_taken',
'updated_by_canceled',
'cancel_description',
'semester',
'school_year',
'created_at',
'updated_at',
];
protected $casts = [
'student_id' => 'integer',
'updated_by_open' => 'integer',
'updated_by_closed' => 'integer',
'updated_by_canceled' => 'integer',
'flag_datetime' => 'datetime',
];
/* Optional relationships */
public function student()
{
return $this->belongsTo(Student::class, 'student_id');
}
public function openedBy()
{
return $this->belongsTo(User::class, 'updated_by_open');
}
public function closedBy()
{
return $this->belongsTo(User::class, 'updated_by_closed');
}
public function canceledBy()
{
return $this->belongsTo(User::class, 'updated_by_canceled');
}
}