LAR_Maintenance/app/Livewire/MaintenanceHistory/DataTable.php
2024-07-31 17:04:33 +02:00

33 lines
763 B
PHP

<?php
namespace App\Livewire\MaintenanceHistory;
use App\Models\MaintenanceHistory;
use SteelAnts\DataTable\Livewire\DataTableComponent;
use Illuminate\Database\Eloquent\Builder;
class DataTable extends DataTableComponent
{
public $listeners = [
'maintenanceHistoryAdded' => '$refresh',
'closeModal' => '$refresh',
];
public function query(): Builder
{
return MaintenanceHistory::query();
}
public function headers(): array
{
return [
'maintenance.name' => 'maintenance.name',
'start_at' => 'start_at',
'finished_at' => 'finished_at',
];
}
public function remove($maintenancehistory_id){
MaintenanceHistory::find($maintenancehistory_id)->delete();
}
}