Closed Acen closed 6 years ago
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?
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.
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.
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.