Skip to content

Commit

Permalink
Simplify subscription method (#1003)
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints authored Sep 25, 2020
1 parent 9024107 commit 9989125
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/Concerns/ManagesSubscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,7 @@ public function subscribed($name = 'default', $plan = null)
*/
public function subscription($name = 'default')
{
return $this->subscriptions->sortByDesc(function (Subscription $subscription) {
return $subscription->created_at->getTimestamp();
})->first(function (Subscription $subscription) use ($name) {
return $subscription->name === $name;
});
return $this->subscriptions()->where('name', $name)->first();
}

/**
Expand Down

0 comments on commit 9989125

Please sign in to comment.