fix: simpan nomor HP wali saat registrasi & taut anak → kolom HP terisi, backfill data siswa saat approve jalan, auto-verifikasi kini benar-benar berfungsi (diuji end-to-end +62 vs 0)

This commit is contained in:
Novy San87
2026-08-06 22:10:34 +07:00
parent 505d060df2
commit 5b66339951
3 changed files with 15 additions and 2 deletions
@@ -77,9 +77,16 @@ class ParentAuthController extends Controller
'role' => 'parent',
'roles' => ['parent'],
'is_active' => true,
'phone' => $phone,
]);
}
// Simpan nomor HP wali ke akun bila masih kosong (dipakai juga
// untuk mengisi data kontak siswa saat verifikasi oleh admin).
if (empty($user->phone)) {
$user->update(['phone' => $phone]);
}
// Verifikasi otomatis jika HP cocok dengan data orang tua di database
$autoVerified = PhoneHelper::matches($phone, $student->parent_phone);
@@ -531,6 +531,11 @@ class ParentStudentController extends Controller
$autoVerified = PhoneHelper::matches(trim($validated['parent_phone']), $student->parent_phone);
// Simpan nomor HP wali bila akun belum punya.
if (empty($user->phone)) {
$user->update(['phone' => trim($validated['parent_phone'])]);
}
$link = ParentStudent::create([
'user_id' => $user->id,
'student_id' => $student->id,