From b583e8b49cf17f9e125f8c7f5c4f5d04ff25d97a Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Sat, 4 Apr 2026 02:28:00 +0700 Subject: [PATCH] fix: use media creation date as fallback for path generation instead of current date --- app/MediaLibrary/CustomPathGenerator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/MediaLibrary/CustomPathGenerator.php b/app/MediaLibrary/CustomPathGenerator.php index 3e51ffc..61c2445 100644 --- a/app/MediaLibrary/CustomPathGenerator.php +++ b/app/MediaLibrary/CustomPathGenerator.php @@ -10,7 +10,7 @@ class CustomPathGenerator implements PathGenerator public function getPath(Media $media): string { $feature = $media->getCustomProperty('feature', 'misc'); - $date = $media->getCustomProperty('date', now()->toDateString()); + $date = $media->getCustomProperty('date', $media->created_at?->toDateString() ?? now()->toDateString()); $docType = $media->getCustomProperty('doc_type'); $feature = str($feature)->slug();