diff --git a/src/Database/Eloquent/Concerns/HasTimestamps.php b/src/Database/Eloquent/Concerns/HasTimestamps.php index 8b2954f..cac16ca 100644 --- a/src/Database/Eloquent/Concerns/HasTimestamps.php +++ b/src/Database/Eloquent/Concerns/HasTimestamps.php @@ -20,7 +20,7 @@ trait HasTimestamps public function setCreatedAt($value): static { $this->{$this->getCreatedAtColumn()} = $value; - if (config('koffinate.core.model.use_perform_by')) { + if (config('koffinate.core.model.use_perform_by') && ! request()->has($this->getCreatedByColumn())) { $this->setPerformedBy(); $this->{$this->getCreatedByColumn()} = $this->performBy; } @@ -38,7 +38,7 @@ public function setCreatedAt($value): static public function setUpdatedAt($value): static { $this->{$this->getUpdatedAtColumn()} = $value; - if (config('koffinate.core.model.use_perform_by')) { + if (config('koffinate.core.model.use_perform_by') && ! request()->has($this->getUpdatedByColumn())) { $this->setPerformedBy(); $this->{$this->getUpdatedByColumn()} = $this->performBy; } diff --git a/src/Database/Eloquent/SoftDeletes.php b/src/Database/Eloquent/SoftDeletes.php index 5924963..26c9fb8 100644 --- a/src/Database/Eloquent/SoftDeletes.php +++ b/src/Database/Eloquent/SoftDeletes.php @@ -23,7 +23,7 @@ protected function runSoftDelete(): void $this->{$this->getDeletedAtColumn()} = $time; - if (config('koffinate.core.model.use_perform_by')) { + if (config('koffinate.core.model.use_perform_by') && ! request()->has($this->getDeletedByColumn())) { $this->setPerformedBy(); $columns[$this->getDeletedByColumn()] = $this->performBy; $this->{$this->getDeletedByColumn()} = $this->performBy; @@ -64,7 +64,7 @@ public function restore(): ?bool $this->{$this->getDeletedAtColumn()} = null; $this->{$this->getRestoreAtColumn()} = $this->freshTimestamp(); - if (config('koffinate.core.model.use_perform_by')) { + if (config('koffinate.core.model.use_perform_by') && ! request()->has($this->getRestoreByColumn())) { $this->setPerformedBy(); $this->{$this->getDeletedByColumn()} = null; $this->{$this->getRestoreByColumn()} = $this->performBy;