fix reportcard and certificate

This commit is contained in:
root
2026-05-27 14:11:08 -04:00
parent c294d7bed7
commit 3737b3522d
6 changed files with 378 additions and 54 deletions
+18
View File
@@ -12,6 +12,7 @@ class CertificateRecordModel extends Model
protected $allowedFields = [
'certificate_number',
'verification_token',
'student_id',
'student_name',
'grade',
@@ -44,6 +45,23 @@ class CertificateRecordModel extends Model
return 'ARSS-' . $schoolYear . '-' . $seq;
}
public function generateVerificationToken(): string
{
$db = \Config\Database::connect();
do {
$token = bin2hex(random_bytes(16));
$exists = $db->table($this->table)
->select('id')
->where('verification_token', $token)
->limit(1)
->get()
->getRowArray();
} while ($exists);
return $token;
}
/** Returns paginated records with the issuing admin's name joined. */
public function getAuditLog(?string $schoolYear = null, int $perPage = 50): array
{