Skip to content

fix: scope subscription slug uniqueness per subscriber - #39

Merged
mckenziearts merged 1 commit into
mainfrom
fix/scope-subscription-slug-uniqueness-per-subscriber
Feb 4, 2026
Merged

fix: scope subscription slug uniqueness per subscriber#39
mckenziearts merged 1 commit into
mainfrom
fix/scope-subscription-slug-uniqueness-per-subscriber

Conversation

@mckenziearts

Copy link
Copy Markdown
Member

Previously, subscription slugs were unique globally across all subscribers, causing slugs to increment unnecessarily (e.g., "enterprise", "enterprise-1", "enterprise-2").

Now, slug uniqueness is scoped to the subscriber (subscriber_type + subscriber_id), allowing multiple subscribers to have subscriptions with the same slug.

Problem

Subscription slugs were unique globally across all subscribers. When multiple subscribers subscribed to the same plan, slugs would increment unnecessarily:

subscriber_id slug
1 enterprise
2 enterprise-1
3 enterprise-2

Solution

Scope the slug uniqueness check to the subscriber using Spatie Sluggable's extraScope() method. Now each subscriber can have a subscription with the same slug:

subscriber_id slug
1 enterprise
2 enterprise
3 enterprise

Changes

  • Updated getSlugOptions() in Subscription model to scope uniqueness by subscriber_type and subscriber_id

@mckenziearts mckenziearts self-assigned this Feb 4, 2026
@mckenziearts
mckenziearts merged commit a853f72 into main Feb 4, 2026
26 checks passed
@mckenziearts
mckenziearts deleted the fix/scope-subscription-slug-uniqueness-per-subscriber branch February 4, 2026 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant