<?php
// cms/modals-read.php
header('Content-Type: application/json');

require_once('db_connection.php');

try {
    $data = [];

    // Obtener datos de la \u00fanica fila de la tabla cms_modals
    $stmt = $pdo->query("SELECT * FROM cms_modals ORDER BY updated_at DESC LIMIT 1");
    $generalData = $stmt->fetch(PDO::FETCH_ASSOC);

    if ($generalData) {
        $data = $generalData;
    } 

    echo json_encode(['success' => true, 'data' => $data]);
} catch (PDOException $e) {
    http_response_code(500);
    echo json_encode(['success' => false, 'message' => 'Error Al Cargar Los Datos: ' . $e->getMessage()]);
}
?>