<?php
$files = [
    'laporan-absen-siswa.blade.php' => 'absen_siswa',
    'laporan-absen-guru.blade.php' => 'absen_guru',
    'laporan-ngajar-guru.blade.php' => 'ngajar_guru',
    'laporan-pelanggaran.blade.php' => 'pelanggaran',
    'laporan-prestasi.blade.php' => 'prestasi',
    'laporan-absen-mapel.blade.php' => 'absen_mapel'
];

foreach ($files as $file => $type) {
    $path = "resources/views/admin/pages/$file";
    if (!file_exists($path)) {
        echo "Not found: $path\n";
        continue;
    }
    
    $content = file_get_contents($path);
    // Replace right after 'rows' => $data,
    $content = preg_replace("/('rows'\s*=>\s*\\\$data,)/", "$1\n    'exportType' => '$type',", $content);
    file_put_contents($path, $content);
    echo "Updated $file\n";
}
