diff --git a/app/Console/Commands/MediaS3GarbageCollector.php b/app/Console/Commands/MediaS3GarbageCollector.php index 431b5d1f5..7cbadc5f3 100644 --- a/app/Console/Commands/MediaS3GarbageCollector.php +++ b/app/Console/Commands/MediaS3GarbageCollector.php @@ -66,7 +66,13 @@ class MediaS3GarbageCollector extends Command return; } - $minId = Media::orderByDesc('id')->where('created_at', '<', now()->subHours(12))->first()->id; + $minId = Media::orderByDesc('id')->where('created_at', '<', now()->subHours(12))->first(); + + if(!$minId) { + return; + } else { + $minId = $minId->id; + } return $hugeMode ? $this->hugeMode($minId, $limit, $log) :