From ec7a43ddd15aaa6b6c93ea4e21fd58bdf2a09dc1 Mon Sep 17 00:00:00 2001 From: Ryan Drewniak Date: Fri, 9 Aug 2024 15:20:24 -0600 Subject: [PATCH] Convert $lastMod to a timestamp if it's a Carbon instance --- src/Support/Sitemapamic.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Support/Sitemapamic.php b/src/Support/Sitemapamic.php index 3778cc8..c9318ca 100644 --- a/src/Support/Sitemapamic.php +++ b/src/Support/Sitemapamic.php @@ -299,6 +299,12 @@ protected function loadCollectionTerms(): \Illuminate\Support\Collection // get the last modified entry $entryLastMod = $termEntries->first()->get('updated_at'); + // Check if the $lastMod is being returned as a Carbon instance instead of an int + if (!is_int($lastMod)) { + // Convert to a timestamp if it's a Carbon instance + $lastMod = $lastMod->timestamp; + } + // entry date is after the term's mod date if ($entryLastMod > $lastMod) { $lastMod = $entryLastMod;