onQueue('posthog'); } public function handle(PostHogService $postHog): void { if (! PostHogService::shouldTrack()) { return; } $user = User::find($this->userId); if (! $user) { return; } $attribution = collect(AttributionKeys::all()) ->mapWithKeys(fn (string $key) => [$key => $user->{$key}]) ->filter() ->all(); $postHog->identify($user->id, [ '$email' => $user->email, '$name' => $user->name, '$set_once' => [ 'signed_up_at' => $user->created_at?->toIso8601String(), ...$attribution, ], ]); if ($user->account_id) { SyncAccountUsage::dispatch( $user->account_id, $user->current_workspace_id ? $user->current_workspace_id : null, ); } } }