Skip to content

Commit

Permalink
Merge pull request #37 from bgultekin/master
Browse files Browse the repository at this point in the history
Update fire condition of SubscriptionPlanChanged
  • Loading branch information
gerardojbaez committed May 29, 2018
2 parents 1dd750c + a25cdd9 commit bb002a2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Laraplans/Models/PlanSubscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ protected static function boot()
});

static::saved(function ($model) {
if ($model->getOriginal('plan_id') !== $model->plan_id) {
// check if there is a plan and it is changed
if ($model->getOriginal('plan_id') && $model->getOriginal('plan_id') !== $model->plan_id) {
event(new SubscriptionPlanChanged($model));
}
});
Expand Down

0 comments on commit bb002a2

Please sign in to comment.