From 14fbf6234736fd2d34783e1d44ebf4a234e8dba9 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Mon, 30 May 2022 20:52:33 +0100 Subject: [PATCH] Add a default `lastModified` Useful when you're duplicating an entry and the new entry has a new model and therefore doesn't have a `lastModified` value --- src/Entries/Entry.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Entries/Entry.php b/src/Entries/Entry.php index cbe04e05..0250ba94 100644 --- a/src/Entries/Entry.php +++ b/src/Entries/Entry.php @@ -2,6 +2,7 @@ namespace Statamic\Eloquent\Entries; +use Illuminate\Support\Carbon; use Statamic\Eloquent\Entries\EntryModel as Model; use Statamic\Entries\Entry as FileEntry; @@ -61,7 +62,7 @@ public function model($model = null) public function lastModified() { - return $this->model->updated_at; + return $this->model->updated_at ?? Carbon::now(); } public function origin($origin = null)