Skip to content

Commit

Permalink
Merge pull request #239 from Woutrrr/fix/using-this-in-static-context
Browse files Browse the repository at this point in the history
Fix using $this in static context in Subscription.php
  • Loading branch information
Naoray authored Apr 19, 2024
2 parents ff8a0b8 + 25d713a commit cd54a44
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -638,13 +638,13 @@ public static function handlePaymentPaid(OrderItem $item)
$subscription = $item->orderable;

if ($subscription->ends_at !== null) {
DB::transaction(function () use ($item) {
if (! $this->scheduled_order_item_id) {
$item = $this->scheduleNewOrderItemAt($this->ends_at);
DB::transaction(function () use ($item, $subscription) {
if (! $subscription->scheduled_order_item_id) {
$item = $subscription->scheduleNewOrderItemAt($subscription->ends_at);
}

$this->fill([
'cycle_ends_at' => $this->plan()->interval()->getEndOfNextSubscriptionCycle($this),
$subscription->fill([
'cycle_ends_at' => $subscription->plan()->interval()->getEndOfNextSubscriptionCycle($subscription),
'ends_at' => null,
'scheduled_order_item_id' => $item->id,
])->save();
Expand Down

0 comments on commit cd54a44

Please sign in to comment.