<?php

namespace App\Modelos;

use Core\Database;

class Caja extends Database
{
    protected $table = 'app_cajas';
    protected  $id = 'caj_id';

    public function obtenerCajas()
    {
        return $this->consultar("SELECT * 
        FROM app_cajas caj        
        JOIN app_metodopago met ON met.mp_id = caj.caj_mpid
        JOIN app_impresoras imp ON imp.imp_id = caj.caj_impresora
        JOIN app_series s ON s.ser_id = imp.imp_serid")->all();
    }

    public function buscarEmpleados(string $buscar)
    {
        return $this->consultar("SELECT einfo_id id, CONCAT(einfo_nombres, ' ' ,einfo_apellidos) nombre
        FROM app_empleados_info        
        WHERE (LOWER(einfo_nombres) LIKE  '%$buscar%' OR LOWER(einfo_apellidos) LIKE '%$buscar%')")->all();
    }
}
