info('Drip emails are disabled. Nothing to do.'); return self::SUCCESS; } $queued = 0; AiConsent::query() ->active() ->whereDate('accepted_at', today()->subDays(2)) ->with('user') ->chunkById(100, function (Collection $consents) use (&$queued): void { foreach ($consents as $consent) { $user = $consent->user; if ($user === null) { continue; } if ($consent->accepted_at->lessThanOrEqualTo($user->created_at->copy()->addDays(self::ONBOARDING_GRACE_DAYS))) { continue; } SendAiConsentFollowUpEmailJob::dispatch($user); $queued++; } }); $this->info("Queued {$queued} AI consent follow-up email(s)."); return self::SUCCESS; } }