public function getTotalVendaCliente($cliente_id) { $venda = $this->venda->where('cliente_id', $cliente_id)->get(); $total = 0; foreach ($venda as $v) { foreach ($v->venda_itens as $vi) { $total += $vi->quantidade * $vi->preco_venda; } } return $total; }