<?php
require_once('includes/definition.php');
class home_model{
    private $db;
    private $query;

    public function __construct(){
        $this->db=Conectar::conexion();
        $this->query=array();
    }

    public function cambio_clave($clave,$user){
        $consulta=$this->db->query("UPDATE users SET user_pass='$clave' WHERE id_user='$user' ");
        return $consulta;
    }

    public function avatar_change($name,$user){
        $consulta=$this->db->query("UPDATE users SET avatar_img='$name' WHERE id_user='$user' ");
        return $consulta;
    }
    public function query_avatar($user){
        $consulta=$this->db->query("SELECT b.avatar_img as avatar FROM users as b  WHERE b.id_user='$user'");
        while($filas=$consulta->fetch_assoc()){
            $this->query[]=$filas;
        }
        return $this->query;
    }

/**
* Cerrar cuentas.
*
*Funcion para Cerrar cuentas*
*
* @return Boolean  
*/
public function close_cash_register($user){
    $create_date=date('Y-m-d H:i:s');
    $date=date('Y-m-d');

    $update=$this->db->query("UPDATE accounts_balance SET id_status='2',close_date='$create_date' WHERE id_status='1' ");
    return $update;
}

}
?>