diff --git a/app/Http/Livewire/ShowMantenimiento.php b/app/Http/Livewire/ShowMantenimiento.php index d320247..0c5a28f 100644 --- a/app/Http/Livewire/ShowMantenimiento.php +++ b/app/Http/Livewire/ShowMantenimiento.php @@ -25,13 +25,13 @@ class ShowMantenimiento extends Component $this->cont = $historialesConEstadoPendiente->toArray(); - return view('livewire.show-mantenimiento',[ + return view('livewire.show-mantenimiento', [ 'historiales' => $historialesConEstadoPendiente ]); } - public function seleccionarTodos(){ - + public function seleccionarTodos() + { if (count($this->delete_1) == 0) { $this->delete_1 = array_column($this->cont['data'], 'id'); } else { @@ -41,6 +41,16 @@ class ShowMantenimiento extends Component //dd($this->delete_1); } + public function eliminarCuentasSinHistorial() + { + Historial_cuenta::whereNull('historial_id')->delete(); + + $this->alert('success', 'Historiales vacios eliminados correctamente!', [ + 'position' => 'top' + ]); + } + + public function eliminarCuentas() { Historial_cuenta::whereIn('id', $this->delete_1)->delete(); @@ -50,6 +60,5 @@ class ShowMantenimiento extends Component $this->alert('success', 'Historiales eliminados correctamente!', [ 'position' => 'top' ]); - } } diff --git a/resources/views/livewire/show-mantenimiento.blade.php b/resources/views/livewire/show-mantenimiento.blade.php index e2cb28c..04e72ef 100644 --- a/resources/views/livewire/show-mantenimiento.blade.php +++ b/resources/views/livewire/show-mantenimiento.blade.php @@ -18,7 +18,9 @@ -