recreate project

This commit is contained in:
root
2026-02-10 22:11:06 -05:00
commit 663c0cdbda
10149 changed files with 1379710 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class ParentNotificationModel extends Model
{
protected $table = 'parent_notifications';
protected $primaryKey = 'id';
protected $useTimestamps = true;
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $allowedFields = [
'student_id','code','incident_date','channel','to_address','subject',
'status','response','semester','school_year'
];
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';
}
}