From 439544ef5677992409adc63fae18b7a576180a97 Mon Sep 17 00:00:00 2001 From: lizandrogd <77708265+lizandrogd@users.noreply.github.com> Date: Thu, 27 Feb 2025 19:41:44 -0500 Subject: [PATCH] Update validacionCompra.php --- app/Console/Commands/validacionCompra.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Console/Commands/validacionCompra.php b/app/Console/Commands/validacionCompra.php index 46a018d..c113ab1 100644 --- a/app/Console/Commands/validacionCompra.php +++ b/app/Console/Commands/validacionCompra.php @@ -98,7 +98,7 @@ class validacionCompra extends Command 'detalle' => 'Se ha corregido la compra duplicada, usuario: ' . $email . ' - ' . Carbon::parse($registro->created_at)->format('d M Y h:i A') . ' - ' . Carbon::parse($anterior->created_at)->format('d M Y h:i A'), - ]); + ]); } } @@ -154,6 +154,8 @@ class validacionCompra extends Command $historial_actual->estado = 'cancelado'; $historial_actual->save(); + + $cuentahistorial = Historial_cuenta::where('historial_id', $historial_actual->id)->get(); // Eliminar cuentas asociadas if (!$cuentahistorial->isEmpty()) { @@ -162,6 +164,11 @@ class validacionCompra extends Command } } + Log_general::where('historial_id', $actual) + ->where('tipo', 'compra') + ->update(['tipo' => 'revertida']); + + DB::commit(); // Confirmar la transacción return true; //