where('status', Status::Connected) ->whereNotNull('token_expires_at') ->where('token_expires_at', '<=', now()->addHours(2)) ->chunk(50, function ($accounts) use (&$count) { foreach ($accounts as $account) { RefreshSocialToken::dispatch($account); $count++; } }); $this->info("Dispatched {$count} token refresh jobs."); } }