Skip to content

feat(cloud): Implement Entitlements with plan features and gating middleware #8

Description

@nfebe

Task

Provide the real Entitlements implementation from plan data and gate routes by feature key.

Actions

  • Add a machine-readable feature_keys array to each plan in config/cloudplans.php.
  • Implement the core App\Contracts\Entitlements interface in the cloud plugin (allows / limit resolved from the user's active plan) and rebind it in the cloud service provider.
  • Register a cloud.feature:{key} route middleware that calls Entitlements::allows.
  • Cache the plan-to-feature and user-to-entitlement maps in Redis, invalidated on the Cashier webhook.

Acceptance

  • A route behind cloud.feature:plaid returns 403 for an unentitled user and 200 for an entitled one.
  • The gate costs a single cached read; no Stripe call inline.
  • Disabling the cloud plugin reverts gating to the core allow-all default.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions