From 2515815e57efdd8576a02ca14d59ca1f14daceea Mon Sep 17 00:00:00 2001 From: Felipe Date: Thu, 10 Oct 2024 15:38:15 -0500 Subject: [PATCH] update --- app/Http/Livewire/ShowPlanes.php | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/app/Http/Livewire/ShowPlanes.php b/app/Http/Livewire/ShowPlanes.php index b91f281..0defcf1 100755 --- a/app/Http/Livewire/ShowPlanes.php +++ b/app/Http/Livewire/ShowPlanes.php @@ -224,8 +224,6 @@ class ShowPlanes extends Component { $this->fecha_inicial_renovar = Carbon::now()->format('Y-m-d'); $this->fecha_final_renovar = Carbon::now()->addDays(30)->format('Y-m-d'); - - } @@ -319,22 +317,24 @@ class ShowPlanes extends Component $servicio_id = $cuenta_renovar->servicio->id; $servicioPantallas = Servicio::find($servicio_id)->pantallas; - - if($this->estado == 'activo'){ + + if ($this->estado == 'activo') { $cuentasPendientes = Pendientes::where('estado', 'pendiente')->where('servicio_id', $servicio_id)->take($servicioPantallas)->get(); foreach ($cuentasPendientes as $i => $cuentaPendiente) { $servicioName = $cuentaPendiente->servicio->nombre; - + $historial_cuenta = new Historial_cuenta(); $historial_cuenta->historial_id = $cuentaPendiente->historial_id; $historial_cuenta->cuenta_id = $id; $historial_cuenta->perfil = $i + 1; $historial_cuenta->save(); $cuentaPendiente->update(['estado' => 'cerrado']); - - $cuentaPendiente->historial->vendedor->notify(new NotificacionPendiente($servicioName)); - + + if ($cuentaPendiente->historial->vendedor !== null) { + $cuentaPendiente->historial->vendedor->notify(new NotificacionPendiente($servicioName)); + } + $consulta = new Notificacion(); $consulta->remitente_id = Auth::user()->id; $consulta->destinatario_id = $historial_cuenta->historial->vendedor_id; @@ -343,7 +343,7 @@ class ShowPlanes extends Component $consulta->estado = true; $consulta->todos = false; $consulta->save(); - + $logsGeneral = new Log_general(); $logsGeneral->user_id = $historial_cuenta->historial->vendedor_id; $logsGeneral->detalle = 'Se asigno una cuenta ' . $servicioName . ', con credenciales: ' . $historial_cuenta->cuenta->correo . ' contraseƱa: ' . $historial_cuenta->cuenta->password . ' Que se encontraba en estado pendiente'; @@ -476,7 +476,9 @@ class ShowPlanes extends Component $historial_cuenta->save(); $cuentaPendiente->update(['estado' => 'cerrado']); - $cuentaPendiente->historial->vendedor->notify(new NotificacionPendiente($servicioName)); + if ($cuentaPendiente->historial->vendedor !== null) { + $cuentaPendiente->historial->vendedor->notify(new NotificacionPendiente($servicioName)); + } $consulta = new Notificacion(); $consulta->remitente_id = Auth::user()->id; @@ -871,7 +873,5 @@ class ShowPlanes extends Component } else { $this->delete_1 = []; } - - } }