<?php
require __DIR__ . '/vendor/autoload.php';
$app = require_once __DIR__ . '/bootstrap/app.php';
$app->make('Illuminate\Contracts\Console\Kernel')->bootstrap();

use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\DB;

// Reset semua guru sekaligus berdasarkan NIP — lebih aman dari ID
$nipBermasalah = [
    '6535747649200022', // Fibrian Kartika Nuswanto
    '4447762663130173', // Edi Hariyanto
    '3739766667130182', // Fitriyah Arizkiyanti
    '4743763664300082', // Uswatun Hasanah
    '9651770671130122', // Haris Nurtanio
    '8152760661300073', // Firlya Citra Kurniawati
    '1957769670130032', // Ahmad Timbul Sholeh
    '1949759659200002', // Muhammad Sudarmaji
    '5641769670230172', // Ayu Ridhawati
    '8558757658200002', // Adi Sumantri
    '0043764665130213', // Suwarno Arieska
    '8955757659300062', // Ratnaningtyas Trisnasanti
];

$newPassword = Hash::make('password');
$berhasil = 0;

foreach ($nipBermasalah as $nip) {
    $affected = DB::table('gurus')
        ->where('nip', $nip)
        ->update(['password' => $newPassword]);

    if ($affected) {
        $nama = DB::table('gurus')->where('nip', $nip)->value('nama');
        echo "✅ Reset: {$nama} ({$nip})<br>";
        $berhasil++;
    } else {
        echo "❌ NIP tidak ditemukan: {$nip}<br>";
    }
}

echo "<br><strong>Selesai! {$berhasil} password berhasil direset.</strong>";
echo "<br>Login dengan password: <strong>password</strong>";
?>