<?php

require __DIR__ . '/vendor/autoload.php';

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

$user = App\Models\User::find(24);

if ($user) {
    echo "Current data:\n";
    echo "  user_category_id: {$user->user_category_id}\n";
    echo "  user_type_id: {$user->user_type_id}\n";
    
    // Get the user type
    $userType = App\Models\UserType::find($user->user_type_id);
    
    if ($userType) {
        echo "\nUser Type '{$userType->name}' belongs to category: {$userType->user_category_id}\n";
        
        // Update user to match
        $user->user_category_id = $userType->user_category_id;
        $user->save();
        
        echo "\n✅ Updated user 24 to category {$userType->user_category_id}\n";
    } else {
        echo "\n❌ User type {$user->user_type_id} not found\n";
    }
} else {
    echo "User 24 not found\n";
}
