Skip to content

Commit

Permalink
[14.x] Fix wrong foreignKey on SubscriptionItem (#1494)
Browse files Browse the repository at this point in the history
* fix wrong fk on SubscriptionItem

fix wrong fk from SubscriptionItem to Subscription (needed on customized migrations)

* Update SubscriptionItem.php

Co-authored-by: Dries Vints <dries@vints.io>
  • Loading branch information
zofe and driesvints authored Jan 25, 2023
1 parent 4bac468 commit 79e315f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/SubscriptionItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ class SubscriptionItem extends Model
*/
public function subscription()
{
return $this->belongsTo(Cashier::$subscriptionModel);
$model = Cashier::$subscriptionModel;

return $this->belongsTo($model, (new $model)->getForeignKey());
}

/**
Expand Down

0 comments on commit 79e315f

Please sign in to comment.