From 9e48b67e94bba7f794a9dc8ad1e25a812ff16e09 Mon Sep 17 00:00:00 2001 From: Novy San87 Date: Fri, 7 Aug 2026 10:54:22 +0700 Subject: [PATCH] =?UTF-8?q?fix(parent):=20saat=20wali=20membuat=20link=20b?= =?UTF-8?q?aru,=20hapus=20otomatis=20link=20REJECTED=20lain=20(NISN=20sala?= =?UTF-8?q?h)=20=E2=80=94=20cegah=20siswa=20dobel=20di=20aplikasi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Api/ParentStudentController.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/Http/Controllers/Api/ParentStudentController.php b/app/Http/Controllers/Api/ParentStudentController.php index 03b3bcd..3d2eeaa 100644 --- a/app/Http/Controllers/Api/ParentStudentController.php +++ b/app/Http/Controllers/Api/ParentStudentController.php @@ -547,6 +547,12 @@ class ParentStudentController extends Controller ]); $link = $existing; } 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([ 'user_id' => $user->id, 'student_id' => $student->id,