﻿# Tambah route thankyou
file = r'routes\web.php'
with open(file, 'r', encoding='utf-8') as f:
    c = f.read()

old = "    Route::get('/{token}', [PublicTestController::class, 'show'])->name('show');"
new = "    Route::get('/{token}', [PublicTestController::class, 'show'])->name('show');\n    Route::get('/done/{participantToken}', [PublicTestController::class, 'thankyou'])->name('thankyou');"

if old in c:
    c = c.replace(old, new)
    print("route: OK")
else:
    print("GAGAL route")

with open(file, 'w', encoding='utf-8') as f:
    f.write(c)
