Skip to content
This repository has been archived by the owner on Nov 9, 2021. It is now read-only.

Commit

Permalink
Fixed quota check
Browse files Browse the repository at this point in the history
  • Loading branch information
rennokki committed Aug 5, 2020
1 parent bbaef5c commit 44289fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 18 deletions.
15 changes: 7 additions & 8 deletions src/Concerns/HasQuotas.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,16 +185,15 @@ public function featuresOverQuotaWhenSwapping(string $planId)
$plan = Saas::getPlan($planId);

return collect($plan->getFeatures())
->filter
->isNotResettable()
->reject
->isUnlimited()
->reject->isResettable()
->reject->isUnlimited()
->filter(function (Feature $feature) use ($plan) {
return $this->getRemainingQuota(
$remainingQuota = $this->getRemainingQuota(
$feature->getId(), $plan->getId()
) < 0;
})
->values();
);

return $remainingQuota <= 0;
});
}

/**
Expand Down
10 changes: 0 additions & 10 deletions src/Feature.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,6 @@ public function isResettable(): bool
return $this->resettable;
}

/**
* Check if this feature is not resettable after each billing cycle.
*
* @return bool
*/
public function isNotResettable(): bool
{
return ! $this->isResettable();
}

/**
* Check if the feature has unlimited uses.
*
Expand Down

0 comments on commit 44289fb

Please sign in to comment.