Ventas->Listado->Ventas
This commit is contained in:
22
app/src/Service/Venta.php
Normal file
22
app/src/Service/Venta.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
namespace Incoviba\Service;
|
||||
|
||||
use Incoviba\Repository;
|
||||
|
||||
class Venta
|
||||
{
|
||||
public function __construct(
|
||||
protected Repository\Venta $ventaRepository,
|
||||
protected Repository\Venta\EstadoVenta $estadoVentaRepository
|
||||
) {}
|
||||
|
||||
public function getByProyecto(int $proyecto_id): array
|
||||
{
|
||||
$ventas = $this->ventaRepository->fetchByProyecto($proyecto_id);
|
||||
foreach ($ventas as &$venta) {
|
||||
$venta->estados = $this->estadoVentaRepository->fetchByVenta($venta->id);
|
||||
$venta->currentEstado = $this->estadoVentaRepository->fetchCurrentByVenta($venta->id);
|
||||
}
|
||||
return $ventas;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user