'$refresh',
'closeModal' => '$refresh',
];
public function query(): Builder
{
$query = MaintenanceHistory::query();
if ($this->type == "planned") {
$query->whereNull('finished_at');
} elseif ($this->type == "history") {
$query->whereNotNull('finished_at');
}
return $query;
}
public function headers(): array
{
$headers = [
'maintenance.name' => 'maintenance.name',
'start_at' => 'start_at',
];
if ($this->type == "planned") {
$headers['guestor.name'] = 'guestor';
} else {
$headers['finished_at'] = 'finished_at';
}
return $headers;
}
public function remove($maintenancehistory_id)
{
MaintenanceHistory::find($maintenancehistory_id)->delete();
}
public function renderColumnMaintenanceName($val, $row)
{
if ($this->type == "planned") {
$ret = '' . e($val) . '';
} else {
$ret = '' . e($val) . '';
}
return $ret;
}
public function actions($item)
{
return [
[
'type' => "livewire",
'action' => "remove",
'text' => "remove",
'parameters' => $item['id']
]
];
}
}