fix reportcard and certificate
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user