$subjects = App\Models\Subject::with('papers')->get();
foreach($subjects as $s) {
    $has = $s->papers->contains('has_practical', 1);
    $s->update(['has_practical' => $has ? 1 : 0]);
    echo "Updated {$s->name} ({$s->id}): " . ($has ? 'YES' : 'NO') . "\n";
}
echo "Data Sync Complete.\n";
exit();
