From 5890584bb87ff7a0a8bf3548e6b153128df96b82 Mon Sep 17 00:00:00 2001 From: lizandrogd <77708265+lizandrogd@users.noreply.github.com> Date: Mon, 29 Apr 2024 15:34:42 -0500 Subject: [PATCH] up --- app/Http/Livewire/ShowServicios.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Http/Livewire/ShowServicios.php b/app/Http/Livewire/ShowServicios.php index 28f5c0b..360d902 100755 --- a/app/Http/Livewire/ShowServicios.php +++ b/app/Http/Livewire/ShowServicios.php @@ -346,6 +346,10 @@ class ShowServicios extends Component } } } else { + $logsGeneral = new Log_general(); + $logsGeneral->user_id = Auth::user()->id; + $logsGeneral->detalle = 'El usuario ' . Auth::user()->name . ' - ' . Auth::user()->email . ' Tuvo error de "No hay cuentas disponibles" Comprando el servicio ' . $servicioNombre . ' - ' . $cuentasMostar . ' cantidad de ' . $this->cantidad_tarjetaPlan . ' por un valor de $' . $total_valor; + $logsGeneral->save(); $this->alert('warning', 'No hay cuentas disponibles!', [ 'position' => 'top' ]); @@ -353,7 +357,7 @@ class ShowServicios extends Component } $descuento = Saldo::where('usuario_id', Auth::user()->id)->first(); - $saldo_anterior = $descuento->valor; + $saldo_anterior = $descuento->valor ?? 0; $nuevo_saldo = $saldo_anterior - $total_valor; $cobro = $descuento->update(['valor' => $nuevo_saldo]); if ($cobro) { @@ -366,6 +370,10 @@ class ShowServicios extends Component $this->credenciales($historial); } else { + $logsGeneral = new Log_general(); + $logsGeneral->user_id = Auth::user()->id; + $logsGeneral->detalle = 'El usuario ' . Auth::user()->name . ' - ' . Auth::user()->email . ' Tuvo un error con el cobro del servicio ' . $servicioNombre . ' - ' . $cuentasMostar . ' cantidad de ' . $this->cantidad_tarjetaPlan . ' por un valor de $' . $total_valor; + $logsGeneral->save(); $eliminar = Historial_cuenta::where('historial_id', $historial->id)->delete(); $this->alert('warning', 'Error en el cobro, comuniquese con soporte!', [ 'position' => 'top'