option('since-minutes'); if (!is_digit($since)) { throw new InvalidArgumentException('The --since-minutes option must be a valid numeric digit.'); } $query = $repository->getBuilder() ->whereNull('completed_at') ->whereDate('created_at', '<=', CarbonImmutable::now()->subMinutes($since)); $count = $query->count(); if (!$count) { $this->info('There are no orphaned backups to be removed.'); return; } $this->warn("Deleting {$count} backups that have not been marked as completed in the last {$since} minutes."); $query->delete(); } }