-
-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
Hello @mckenziearts ,
I think this method here may be wrong
public function canUseFeature(string $featureSlug): bool
{
$featureValue = $this->getFeatureValue($featureSlug);
$usage = $this->usage()->byFeatureSlug($featureSlug)->first();
if ($featureValue === 'true') {
return true;
}
// If the feature value is zero, let's return false since
// there's no uses available. (useful to disable countable features)
if (! $usage || $usage->expired() || $featureValue === null || $featureValue === '0' || $featureValue === 'false') {
return false;
}
// Check for available uses
return $this->getFeatureRemainings($featureSlug) > 0;
}
why will it fail if there's not usages done already ?
lets say user purchase a plan with feature "contacts" with limit 30
Then if you do
$user->subscription->canUseFeature('contacts')
it will return false, because he never made use of that feature...
Metadata
Metadata
Assignees
Labels
No labels