����JFIF��`�`�����Viewing File: /home/u820193700/domains/throtllr.com/public_html/backend/seed.php
<?php
require_once 'api/db.php';

// Check if we already seeded to prevent duplication
$res = $conn->query("SELECT id FROM users WHERE email = 'rider1@example.com'");
if ($res && $res->num_rows > 0) {
    die(json_encode(['success' => true, 'message' => 'Already seeded']));
}

$pw = password_hash('password123', PASSWORD_BCRYPT);

// 1. Create a Rider
$conn->query("INSERT INTO users (name, email, password, whatsapp_number, role) VALUES ('Rahul Rider', 'rider1@example.com', '$pw', '+919876543210', 'rider')");

// 2. Create Dealers
$conn->query("INSERT INTO users (name, email, password, whatsapp_number, role) VALUES ('Delhi Motors', 'delhi@avahan.com', '$pw', '+919876543211', 'dealer')");
$d1_uid = $conn->insert_id;
$conn->query("INSERT INTO dealers (user_id, showroom_name, location, commission_rate) VALUES ($d1_uid, 'Avahan Delhi Royal', 'New Delhi', 10.00)");
$d1_id = $conn->insert_id;
$conn->query("INSERT INTO dealer_wallets (dealer_id) VALUES ($d1_id)");

$conn->query("INSERT INTO users (name, email, password, whatsapp_number, role) VALUES ('Bangalore Cruisers', 'blr@avahan.com', '$pw', '+919876543212', 'dealer')");
$d2_uid = $conn->insert_id;
$conn->query("INSERT INTO dealers (user_id, showroom_name, location, commission_rate) VALUES ($d2_uid, 'Avahan BLR Adventure', 'Bengaluru', 10.00)");
$d2_id = $conn->insert_id;
$conn->query("INSERT INTO dealer_wallets (dealer_id) VALUES ($d2_id)");

// 3. Create Tours
$desc = "An epic motorcycle journey covering the best landscapes.";
$img1 = "https://images.unsplash.com/photo-1558981403-c5f9899a28bc?w=800&auto=format&fit=crop";
$img2 = "https://images.unsplash.com/photo-1568772585407-9361f9bf3a87?w=800&auto=format&fit=crop";

// Tour 1: Approved
$conn->query("INSERT INTO tours (dealer_id, title, description, start_location, end_location, route_details, start_date, duration_days, price, max_riders, bike_eligibility, image_url, whatsapp_group_link, status) 
VALUES ($d1_id, 'Himalayan High Passes', '$desc', 'Manali', 'Leh', 'Manali -> Jispa -> Sarchu -> Leh', '2026-06-15', 10, 35000, 15, 'Min 350cc required', '$img1', 'https://chat.whatsapp.com/example1', 'approved')");

// Tour 2: Approved
$conn->query("INSERT INTO tours (dealer_id, title, description, start_location, end_location, route_details, start_date, duration_days, price, max_riders, bike_eligibility, image_url, whatsapp_group_link, status) 
VALUES ($d2_id, 'Western Ghats Monsoon Ride', '$desc', 'Bengaluru', 'Goa', 'BLR -> Chikmagalur -> Agumbe -> Goa', '2026-07-20', 5, 18000, 20, 'Open to all', '$img2', 'https://chat.whatsapp.com/example2', 'approved')");

// Tour 3: Pending
$conn->query("INSERT INTO tours (dealer_id, title, description, start_location, end_location, route_details, start_date, duration_days, price, max_riders, bike_eligibility, image_url, whatsapp_group_link, status) 
VALUES ($d2_id, 'Kochi Coastline Cruise', 'Enjoy the scenic backwaters and coasts.', 'Kochi', 'Trivandrum', 'Kochi -> Alleppey -> Varkala', '2026-10-10', 4, 15000, 10, 'Any cruiser', '$img1', 'https://chat.whatsapp.com/example3', 'pending')");

// NEW ADVENTURE TOURS
$img3 = "https://images.unsplash.com/photo-1591637333184-1100f68e0d4c?w=800&auto=format&fit=crop";
$img4 = "https://images.unsplash.com/photo-1593010700010-86b2d15332f1?w=800&auto=format&fit=crop";
$img5 = "https://images.unsplash.com/photo-1517511620798-cec17d428bc0?w=800&auto=format&fit=crop";

// Tour 4: Approved - Spiti Valley
$conn->query("INSERT INTO tours (dealer_id, title, description, start_location, end_location, route_details, start_date, duration_days, price, max_riders, bike_eligibility, image_url, whatsapp_group_link, status) 
VALUES ($d1_id, 'Spiti Valley Expedition', 'Ride through the high altitude cold desert of Spiti. Rugged terrains and ancient monasteries.', 'Shimla', 'Kaza', 'Shimla -> Kalpa -> Tabo -> Kaza -> Losar -> Manali', '2026-08-05', 12, 45000, 12, 'Royal Enfield Himalayan preferred', '$img3', 'https://chat.whatsapp.com/spiti_adv', 'approved')");

// Tour 5: Approved - Rajasthan Royal Ride
$conn->query("INSERT INTO tours (dealer_id, title, description, start_location, end_location, route_details, start_date, duration_days, price, max_riders, bike_eligibility, image_url, whatsapp_group_link, status) 
VALUES ($d1_id, 'Desert Storm: Rajasthan', 'Explore the royal forts and dunes of Rajasthan on two wheels.', 'Jaipur', 'Jaisalmer', 'Jaipur -> Pushkar -> Jodhpur -> Jaisalmer -> Bikaner', '2026-11-20', 8, 28000, 18, 'Open to all', '$img4', 'https://chat.whatsapp.com/rajasthan_ride', 'approved')");

// Tour 6: Approved - North East Seven Sisters
$conn->query("INSERT INTO tours (dealer_id, title, description, start_location, end_location, route_details, start_date, duration_days, price, max_riders, bike_eligibility, image_url, whatsapp_group_link, status) 
VALUES ($d2_id, 'Sikkim Silk Route', 'Breathtaking heights and winding roads of the historic Silk Route.', 'Siliguri', 'Gangtok', 'Siliguri -> Zuluk -> Nathang Valley -> Gangtok', '2026-05-10', 7, 32000, 10, 'Experienced riders only', '$img5', 'https://chat.whatsapp.com/sikkim_adv', 'approved')");

echo json_encode(['success' => true, 'message' => 'Sample data seeded successfully!']);
?>
Back to Directory �������}�!1AQa"q2���#B��R��$3br� %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz�������������������������������������������������������������������������������� ������w�!1AQaq"2�B���� #3R�br� $4�%�&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz������������������������������������������������������������������������ ��?��_��+��?��(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(���(�����