transactionsbelongsTo 0 or 1 subscription (transactions.subscription_id -> subscriptions.id, nullable)
This is because some transactions such as chargebacks do not belongsTo any subscription
subscriptionhasManytransactions, e.g. monthly/annual payments until cancelled
What these implies is that, all subscriptions can be traced back to a buyer, i.e. buyerhasManysubscriptions
Currently, subscriptions does not have a buyer_id because I want to avoid a case where subscriptions.buyer_id differs from transactions.buyer_id due to bugs etc
My question is:
Is not having a buyer_id in subscriptions a good practice?
How do I write the buyer and subscription's model to relate to each other for the current structure? (So that it is also compatible in Nova)
Anyone doing this differently and feels it is better than above?
transactions is a pivot table pointing to buyers and subscriptions but it does not model my situation accurately as each subscription can have only 1 buyer, not a many-to-many relation.