eliminar historiales con historial_id null
This commit is contained in:
@@ -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'
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="my-1 md:my-0">
|
||||
<div class="my-1 md:my-0 flex gap-2">
|
||||
<button wire:click="eliminarCuentasSinHistorial" class="bg-[#b221fd] hover:bg-[#7a02b8] text-white px-4 py-2 rounded">Eliminar</button>
|
||||
|
||||
<button wire:click="eliminarCuentas" class="bg-red-400 text-white px-4 py-2 rounded">Eliminar</button>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user