From e1e23686d4893fd1ac3865988bd4235a936622f3 Mon Sep 17 00:00:00 2001 From: Felipe Date: Fri, 8 Mar 2024 16:40:17 -0500 Subject: [PATCH] log historial --- app/Http/Livewire/ShowLogHistorial.php | 8 +++++++- app/Http/Livewire/ShowPlanes.php | 11 +++++++++-- resources/views/livewire/show-log-historial.blade.php | 5 ++--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/Http/Livewire/ShowLogHistorial.php b/app/Http/Livewire/ShowLogHistorial.php index c36d27d..5c8bd7a 100644 --- a/app/Http/Livewire/ShowLogHistorial.php +++ b/app/Http/Livewire/ShowLogHistorial.php @@ -21,9 +21,15 @@ class ShowLogHistorial extends Component $query = Log_historial::query(); if ($this->buscar) { - $query->where('detalle', 'like', '%' . $this->buscar . '%'); + $query->where(function ($query) { + $query->where('detalle', 'like', '%' . $this->buscar . '%') + ->orWhereHas('user', function ($query) { + $query->where('name', 'like', '%' . $this->buscar . '%'); + }); + }); } + if ($this->filtro_fecha) { $query->whereDate('created_at', $this->filtro_fecha); } diff --git a/app/Http/Livewire/ShowPlanes.php b/app/Http/Livewire/ShowPlanes.php index a9920fe..6ab74da 100755 --- a/app/Http/Livewire/ShowPlanes.php +++ b/app/Http/Livewire/ShowPlanes.php @@ -232,6 +232,8 @@ class ShowPlanes extends Component 'confirmButtonText' => 'Si, liberar cuenta', ]); }else{ + $cuenta_renovar = Cuentas::find($this->id_cuentaVer); + Cuentas::where('id', $this->id_cuentaVer)->update([ 'correo' => $this->usuario_renovar, 'password' => $this->password_renovar, @@ -240,6 +242,11 @@ class ShowPlanes extends Component 'estado' => $this->estado, ]); + Log_historial::create([ + 'user_id' => Auth::user()->id, + 'detalle' => 'El usuario ha editado la cuenta ' . $cuenta_renovar->correo + ]); + $this->alert('success', 'Cuenta actualizada correctamente!', [ 'position' => 'top' ]); @@ -267,7 +274,7 @@ class ShowPlanes extends Component Log_historial::create([ 'user_id' => Auth::user()->id, - 'detalle' => 'El usuario ha renovado la cuenta ' . $cuenta_renovar->correo + 'detalle' => 'El usuario ha editado, renovado y liberado la cuenta ' . $cuenta_renovar->correo ]); $this->alert('success', 'Cuenta renovada y liberada correctamente!', [ @@ -294,7 +301,7 @@ class ShowPlanes extends Component Log_historial::create([ 'user_id' => Auth::user()->id, - 'detalle' => 'El usuario ha renovado la cuenta ' . $cuenta_renovar->correo + 'detalle' => 'El usuario ha editado y renovado la cuenta ' . $cuenta_renovar->correo ]); $this->alert('success', 'Cuenta renovada correctamente!', [ diff --git a/resources/views/livewire/show-log-historial.blade.php b/resources/views/livewire/show-log-historial.blade.php index 1291b8f..bb1def8 100644 --- a/resources/views/livewire/show-log-historial.blade.php +++ b/resources/views/livewire/show-log-historial.blade.php @@ -7,7 +7,7 @@ Log historial
-
- +