Update Saqel Platform: 2026-08-31 01:52:23
This commit is contained in:
@@ -125,16 +125,11 @@ class CurriculumService
|
||||
$teacher = Database::selectOne("SELECT id FROM teachers LIMIT 1");
|
||||
}
|
||||
if (!$teacher) {
|
||||
// Last resort: look up the super_admin user and create a teacher row for them
|
||||
$adminUser = Database::selectOne(
|
||||
"SELECT id FROM users WHERE role = 'super_admin' LIMIT 1"
|
||||
);
|
||||
$adminUserId = $adminUser ? (int)$adminUser['id'] : 1;
|
||||
$tUuid = sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000, mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));
|
||||
$teacherId = Database::insert(
|
||||
"INSERT INTO teachers (user_id, specialization, verification_status)
|
||||
VALUES (?, 'المنهاج الوزاري', 'verified')
|
||||
ON DUPLICATE KEY UPDATE id = LAST_INSERT_ID(id)",
|
||||
[$adminUserId]
|
||||
"INSERT INTO teachers (uuid, full_name, specialization, is_school_exclusive, is_marketplace_public)
|
||||
VALUES (?, 'منهاج الذكاء الاصطناعي والوزارة', 'المنهاج الوزاري المعتمد', 0, 1)",
|
||||
[$tUuid]
|
||||
);
|
||||
} else {
|
||||
$teacherId = (int)$teacher['id'];
|
||||
|
||||
Reference in New Issue
Block a user