class_level . str_pad($i, 3, '0', STR_PAD_LEFT); Student::firstOrCreate( ['nis' => $nis], // Cek berdasarkan NIS [ 'full_name' => 'Siswa ' . $classroom->class_name . ' ' . $i, 'gender' => $gender, 'birth_date' => now()->subYears(rand(15, 18))->subMonths(rand(1, 12)), 'birth_place' => 'Kota ' . chr(65 + rand(0, 25)), 'address' => 'Jl. Contoh No.' . $i, 'phone' => '0812' . rand(1000000, 9999999), 'class_id' => $classroom->id, 'parent_name' => 'Orang Tua Siswa ' . $i, 'religion' => $religion, 'parent_phone' => '0813' . rand(1000000, 9999999), ] ); } } } }