LAR_Maintenance/app/Livewire/MaintenanceHistory/DataTable.php

33 lines
763 B
PHP
Raw Normal View History

2024-07-31 15:04:33 +00:00
<?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();
}
}