Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plan Subscriber forced to be User #18

Closed
Acen opened this issue Aug 3, 2017 · 3 comments
Closed

Plan Subscriber forced to be User #18

Acen opened this issue Aug 3, 2017 · 3 comments
Labels

Comments

@Acen
Copy link
Contributor

Acen commented Aug 3, 2017

Both the traits and migrations directly reference User models, which removes the point of building it into a Trait.

A person may want to integrate their subscriptions on a different kind of Model.

@gerardojbaez
Copy link
Owner

Thanks for taking the time to report the issue.

Sorry for the delay in the reply.

I don't see a direct reference to User model in the Gerardojbaez\LaraPlans\Traits\PlanSubscriber trait, only in the migration for plan_subscriptions table. If we remove the foreign key of user_id that is creating a link between users table and plan_subscriptions table, we should be able to use other models as the subscriber. This is how Cashier handles this. What do you think?

@gerardojbaez
Copy link
Owner

I think using the Polymorphic relation in subscriptions table will be a better approach, this way we can have multiple subscribable models at the same time.

@Acen
Copy link
Contributor Author

Acen commented Nov 15, 2017

Baha, was thinking when I saw the notification for this "ayy, someone reported this issue. I remember thinking this while looking through the codebase". Good stuff getting to it eventually.
I've just been implementing Polymorphic relationships in a new code base, they are great for this sort of thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants