From f24ab683580d644b3c0c2fc5b78bea3b5001cc32 Mon Sep 17 00:00:00 2001 From: lizandrogd <77708265+lizandrogd@users.noreply.github.com> Date: Wed, 2 Apr 2025 00:58:10 -0500 Subject: [PATCH] Update ShowServicios.php --- app/Http/Livewire/ShowServicios.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Http/Livewire/ShowServicios.php b/app/Http/Livewire/ShowServicios.php index 5428d50..d0a2a8c 100755 --- a/app/Http/Livewire/ShowServicios.php +++ b/app/Http/Livewire/ShowServicios.php @@ -183,10 +183,11 @@ class ShowServicios extends Component ->whereDate('vencimiento', '<=', $this->fecha_final_2) ->where('servicio_id', $servicio_tarifa->id) ->where('estado', 'activo') - ->withCount('historiales') - ->havingRaw("(SELECT COUNT(*) FROM historiales WHERE historiales.cuenta_id = cuentas.id) <= ?", [$cantidad_restante]) + ->withCount('historiales') // ✅ Contamos los historiales + ->having('historiales_count', '<=', $cantidad_restante) // ✅ Filtramos los historiales ->get(); + //dd($cuentas_pantallas); // con count da un numero entero $cuentas_pantallas_tomadas = Historial_cuenta::whereIn('cuenta_id', $cuentas_pantallas