fix carbon addDays

This commit is contained in:
xiaomlove
2025-05-02 21:21:37 +07:00
parent 6a3ed230df
commit 8f4a6cf50c
5 changed files with 9 additions and 9 deletions

View File

@@ -223,7 +223,7 @@ class Exam extends NexusModel
return Carbon::parse($this->end);
}
if (!empty($this->duration)) {
return $this->getBeginForUser()->clone()->addDays($this->duration);
return $this->getBeginForUser()->clone()->addDays((int)$this->duration);
}
if (!empty($this->recurring)) {
return $this->getRecurringEnd(Carbon::now());

View File

@@ -104,7 +104,7 @@ class ExamUser extends NexusModel
$duration = $exam->duration;
if ($duration > 0) {
do_log(sprintf('examUser: %s, end from self created_at + exam(%s) created_at: %s + %s days', $this->id, $exam->id, $this->getRawOriginal('created_at'), $duration));
return $this->created_at->addDays($duration)->toDateTimeString();
return $this->created_at->addDays((int)$duration)->toDateTimeString();
}
return null;
}