Recently started working with laravel and have a hard time structuring my project related to the current feature I'm working on.
Basically there exists a Subscription model that contains info about a subscription and most notably contains an expiry date. The feature I'm working on is to automize subscription expiry reminders to "customers" and also auto renew if the customer has not unsubscribed.
The problem is that I'm not sure how to structure the logic for this properly. Currently I have created a class called SubscriptionManager that has 2 functions. notifyExpiring($subscription) and renewExpired($subscription).
These functions require logic based on the subscription. For example: a customer should only be notified by email if the sub is 2 months from expiring. Where should this function be?
Currently I have it as a static function in class SubscriptionHelper called isExpiring($subscription).
As i've understood, logic in a Model class is a no go and I 'm not sure if a Service class is something for this.
Thanks in advance
Aucun commentaire:
Enregistrer un commentaire