Преглед изворни кода

Update NotificationService, handle empty epoch. Fixes #4689

Daniel Supernault пре 1 година
родитељ
комит
457d5454f8
1 измењених фајлова са 3 додато и 0 уклоњено
  1. 3 0
      app/Services/NotificationService.php

+ 3 - 0
app/Services/NotificationService.php

@@ -49,6 +49,9 @@ class NotificationService {
 	public static function getEpochId($months = 6)
 	{
 		return Cache::remember(self::EPOCH_CACHE_KEY . $months, 1209600, function() use($months) {
+            if(Notification::count() === 0) {
+                return 0;
+            }
 			return Notification::where('created_at', '>', now()->subMonths($months))->first()->id;
 		});
 	}