<?php

namespace App\Modelos;

use Core\Database;

class DivisasMetodos extends Database
{
    protected $table = 'app_metodopago_divisa';
    protected $id = 'md_id';

    public function dm()
    {
        return $this->consultar('SELECT md.md_id, m.mp_id, m.mp_codigo, m.mp_nombre, d.div_id, d.div_nombre, d.div_simbolo
        FROM app_metodopago_divisa md
        JOIN app_divisas d ON d.div_id = md.md_divid
        JOIN app_metodopago m ON m.mp_id = md.md_mpid')->all();
    }

    public function dmexiste(int $id_divisa, int $id_metodo)
    {
        return $this->consultar("SELECT md_id FROM app_metodopago_divisa WHERE md_divid=$id_divisa and md_mpid=$id_metodo")->row();
    }
}
