private function copyAttributeAbove(string $attribute, Table $table, Task $record): void
{
$records = $table->getRecords();
$currentRecordIndex = $records->search(function($tableRecord) use ($record) {
return $record->id === $tableRecord->id;
});
if ($currentRecordIndex == 0) {
return;
}
$previousRecord = $records->slice($currentRecordIndex-1, 1)->first();
$record->update([
$attribute => $previousRecord[$attribute],
]);
}
private function copyAttributeAbove(string $attribute, Table $table, Task $record): void
{
$records = $table->getRecords();
$currentRecordIndex = $records->search(function($tableRecord) use ($record) {
return $record->id === $tableRecord->id;
});
if ($currentRecordIndex == 0) {
return;
}
$previousRecord = $records->slice($currentRecordIndex-1, 1)->first();
$record->update([
$attribute => $previousRecord[$attribute],
]);
}