where('photobooth_enabled', true) ->whereNotNull('photobooth_expires_at') ->where('photobooth_expires_at', '<=', now()) ->chunkById(50, function ($events) use (&$total, $provisioner) { foreach ($events as $event) { try { $provisioner->disable($event); $total++; } catch (\Throwable $exception) { Log::error('Failed to disable expired photobooth account', [ 'event_id' => $event->id, 'message' => $exception->getMessage(), ]); } } }); $this->info(sprintf('Photobooth cleanup complete (%d accounts disabled).', $total)); return self::SUCCESS; } }