Obtener caso por ID

<?php
require_once 'Conexion.php';

class ExpedienteModel extends Conexion
{
    static public function obtenerCasoPorId($id)
    {
        $stmt = Conexion::conectar()->prepare("SELECT * FROM casos WHERE id = :id");
        $stmt->bindParam(":id", $id, PDO::PARAM_INT);
        $stmt->execute();
        return $stmt->fetch();
    }
}

if (isset($_GET['id'])) {
    $caso = ExpedienteModel::obtenerCasoPorId($_GET['id']);
}
?>

<!DOCTYPE html>
<html lang="es">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Expediente</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
    <h3>Detalle del Expediente</h3>
    <?php if ($caso) { ?>
        <table class="table">
            <tr>
                <th>ID</th>
                <td><?php echo $caso['id']; ?></td>
            </tr>
            <tr>
                <th>Expediente</th>
                <td><?php echo $caso['numero_expediente']; ?></td>
            </tr>
            <tr>
                <th>Cliente ID</th>
                <td><?php echo $caso['cliente_id']; ?></td>
            </tr>
            <tr>
                <th>Tipo de Caso</th>
                <td><?php echo $caso['tipo_caso']; ?></td>
            </tr>
            <tr>
                <th>Juzgado</th>
                <td><?php echo $caso['juzgado']; ?></td>
            </tr>
            <tr>
                <th>Fecha de Apertura</th>
                <td><?php echo $caso['fecha_apertura']; ?></td>
            </tr>
            <tr>
                <th>Estado</th>
                <td><?php echo $caso['estado']; ?></td>
            </tr>
            <tr>
                <th>Descripción</th>
                <td><?php echo $caso['descripcion']; ?></td>
            </tr>
        </table>
    <?php } else { ?>
        <p class="alert alert-warning">No se encontró el expediente.</p>
    <?php } ?>
    <a href="index.php" class="btn btn-secondary">Regresar</a>
</div>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.min.js"></script>
</body>
</html>

Comentarios