$payload */ public function __construct( public string $accountId, public BillingEvent $event, public array $payload, public ?string $previousPlan = null, ) { $this->onQueue('posthog'); } public function handle(PostHogService $postHog): void { if (! PostHogService::shouldTrack()) { return; } $account = Account::with('plan')->find($this->accountId); if (! $account || ! $account->owner_id) { return; } $postHog->capture( (string) $account->owner_id, $this->event->value, [ 'stripe_status' => data_get($this->payload, 'data.object.status'), 'plan_slug' => $account->plan?->slug->value, 'previous_plan' => $this->previousPlan, ], $account, ); SyncUser::dispatch((string) $account->owner_id); } }