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; //