<?php

namespace App\Modelos;

use Core\Database;

class PedidosArticulos extends Database
{
    protected $table = 'app_pedidos_articulos';
    protected $id = 'peart_id';

    public function articulos($id_factura)
    {
        return $this->consultar("SELECT * FROM app_pedidos_articulos pe
         LEFT JOIN app_productos p ON p.pro_id=pe.peart_proid 
        LEFT JOIN app_impuestos imp ON imp.imp_id=pe.peart_idiva 
        WHERE peart_peid=$id_factura")->all();
    }

    public function eliminarArticulos(int $id_factura)
    {
        return $this->consultar("DELETE FROM app_pedidos_articulos WHERE peart_peid=$id_factura")->run();
    }
}
