This commit is contained in:
lizandrogd
2025-04-02 00:55:15 -05:00
parent 67a40c65ae
commit 8266de9d5f
3 changed files with 64 additions and 30 deletions
+5 -11
View File
@@ -183,16 +183,10 @@ class ShowServicios extends Component
->whereDate('vencimiento', '<=', $this->fecha_final_2)
->where('servicio_id', $servicio_tarifa->id)
->where('estado', 'activo')
//->with('perfil')
//->whereDoesntHave('perfil', function ($query) use ($cantidad_restante) {
// $query->select('cuenta_id')
// ->groupBy('cuenta_id')
// ->havingRaw("COUNT(*) >= $cantidad_restante");
//})
->withCount('historiales')
->where('estado', 'activo')
->having('historiales_count', '<=', $cantidad_restante)
->havingRaw("(SELECT COUNT(*) FROM historiales WHERE historiales.cuenta_id = cuentas.id) <= ?", [$cantidad_restante])
->get();
//dd($cuentas_pantallas); // con count da un numero entero
$cuentas_pantallas_tomadas = Historial_cuenta::whereIn('cuenta_id', $cuentas_pantallas
@@ -474,12 +468,12 @@ class ShowServicios extends Component
DB::rollBack();
$this->credenciales = false;
$this->cuentas =[];
$this->cuentas = [];
$this->alert('warning', 'Error al comprar: Esta cuenta ha sido tomada por otro usuario al mismo tiempo, intenta nuevamente' , [
$this->alert('warning', 'Error al comprar: Esta cuenta ha sido tomada por otro usuario al mismo tiempo, intenta nuevamente', [
'position' => 'top'
]);
}
}