fix(parent): saat wali membuat link baru, hapus otomatis link REJECTED lain (NISN salah) — cegah siswa dobel di aplikasi
This commit is contained in:
@@ -547,6 +547,12 @@ class ParentStudentController extends Controller
|
|||||||
]);
|
]);
|
||||||
$link = $existing;
|
$link = $existing;
|
||||||
} else {
|
} else {
|
||||||
|
// Bersihkan tautan REJECTED lain milik wali (percobaan NISN salah) —
|
||||||
|
// kalau dibiarkan, siswa yang salah NISN tetap muncul dobel di aplikasi.
|
||||||
|
ParentStudent::where('user_id', $user->id)
|
||||||
|
->where('status', 'rejected')
|
||||||
|
->delete();
|
||||||
|
|
||||||
$link = ParentStudent::create([
|
$link = ParentStudent::create([
|
||||||
'user_id' => $user->id,
|
'user_id' => $user->id,
|
||||||
'student_id' => $student->id,
|
'student_id' => $student->id,
|
||||||
|
|||||||
Reference in New Issue
Block a user