mantenimiento
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use App\Models\Historial_cuenta;
|
||||
use Livewire\Component;
|
||||
use Jantinnerezo\LivewireAlert\LivewireAlert;
|
||||
use Livewire\WithPagination;
|
||||
|
||||
class ShowMantenimiento extends Component
|
||||
{
|
||||
use WithPagination;
|
||||
use LivewireAlert;
|
||||
|
||||
public $entradas = 10;
|
||||
public $delete_1 = [];
|
||||
|
||||
public $cont = [];
|
||||
|
||||
public function render()
|
||||
{
|
||||
$historialesConEstadoPendiente = Historial_cuenta::whereHas('historial', function ($query) {
|
||||
$query->where('estado', 'pendiente');
|
||||
})->paginate($this->entradas);
|
||||
|
||||
$this->cont = $historialesConEstadoPendiente->toArray();
|
||||
|
||||
return view('livewire.show-mantenimiento',[
|
||||
'historiales' => $historialesConEstadoPendiente
|
||||
]);
|
||||
}
|
||||
|
||||
public function seleccionarTodos(){
|
||||
|
||||
if (count($this->delete_1) == 0) {
|
||||
$this->delete_1 = array_column($this->cont['data'], 'id');
|
||||
} else {
|
||||
$this->delete_1 = [];
|
||||
}
|
||||
|
||||
dd($this->delete_1);
|
||||
}
|
||||
|
||||
public function eliminarCuentas()
|
||||
{
|
||||
Historial_cuenta::whereIn('id', $this->delete_1)->delete();
|
||||
|
||||
$this->delete_1 = [];
|
||||
|
||||
$this->alert('success', 'Historiales eliminados correctamente!', [
|
||||
'position' => 'top'
|
||||
]);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -770,6 +770,5 @@ class ShowPlanes extends Component
|
||||
}
|
||||
|
||||
|
||||
//dd($this->delete_1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user