add projet

This commit is contained in:
root
2026-03-05 12:29:37 -05:00
parent 8d1eef8ba8
commit 23b7db1107
9109 changed files with 1106501 additions and 73 deletions
+40
View File
@@ -0,0 +1,40 @@
<?php
namespace App\Models;
use App\Models\BaseModel;
class ParentNotification extends BaseModel
{
protected $table = 'parent_notifications';
protected $primaryKey = 'id';
public $timestamps = true;
const CREATED_AT = 'created_at';
const UPDATED_AT = 'updated_at';
protected $fillable = [
'student_id',
'code',
'incident_date',
'channel',
'to_address',
'subject',
'status',
'response',
'semester',
'school_year',
'created_at',
'updated_at',
];
public function hasSent(int $studentId, string $code, string $incidentYmd, string $channel='email', ?string $to=null): bool
{
$qb = $this->where('student_id', $studentId)
->where('code', $code)
->where('incident_date', $incidentYmd)
->where('channel', $channel);
if ($to) $qb->where('to_address', $to);
$row = $qb->orderBy('id','DESC')->first();
return $row && ($row['status'] ?? '') === 'sent';
}
}