Files
alrahma_sunday_school_api/app/Models/Incident.php
T
2026-06-08 23:45:55 -04:00

63 lines
1.4 KiB
PHP

<?php
namespace App\Models;
use App\Models\BaseModel;
class Incident extends BaseModel
{
protected $table = 'incident';
// Table contains created_at/updated_at; enable auto timestamps (recommended).
public $timestamps = true;
protected $fillable = [
'student_id',
'student_name',
'grade',
'incident',
'incident_datetime',
'incident_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',
'incident_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');
}
}