What friends do I need to return the records of the previous day in CodeIgniter, what is the correct way to do it?
Here is the code in my model:
public function getOrdenes(){
$this->db->where("fecha", date("Y-m-d"));
$this->db->where("estado","1");
$resultados = $this->db->get("pedidos");
$return = array();
foreach ($resultados->result() as $pedido)
{
$return[$pedido->id] = $pedido;
$return[$pedido->id]->mesas = $this->getPedidosMesas($pedido->id); // Get the categories sub categories
}
return $return;
}