Skip to content

A free open source IT asset/license management system

Update timestamps

Marcus Moorec8177eb51eae
diff --git a/app/Console/Commands/FixActionLogTimestamps.php b/app/Console/Commands/FixActionLogTimestamps.php
index fd8c946066..de4b00b05c 100644
--- a/app/Console/Commands/FixActionLogTimestamps.php
+++ b/app/Console/Commands/FixActionLogTimestamps.php
@@ -4,6 +4,7 @@ namespace App\Console\Commands;
use App\Models\Actionlog;
use Illuminate\Console\Command;
+use Illuminate\Database\Eloquent\Model;
class FixActionLogTimestamps extends Command
{
@@ -43,9 +44,16 @@ class FixActionLogTimestamps extends Command
// @todo: write ids to console
+ // @todo: get confirmation?
+
foreach ($logs as $log) {
if (!$this->dryrun){
$this->line(vsprintf('Updating log id:%s from %s to %s', [$log->id, $log->created_at, $log->updated_at]));
+
+ Model::withoutTimestamps(function () use ($log) {
+ $log->created_at = $log->updated_at;
+ $log->saveQuietly();
+ });
} else {
$this->line(vsprintf('DRYRUN: Updating log id:%s from %s to %s', [$log->id, $log->created_at, $log->updated_at]));
}