From 2fa79e01f79d6b6bf68a75d2411e274aa80867dd Mon Sep 17 00:00:00 2001 From: Borja Puig Date: Sun, 5 Sep 2021 12:06:36 +0200 Subject: [PATCH] Fix Unsupported operand types error --- src/Models/PlanSubscription.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/Models/PlanSubscription.php b/src/Models/PlanSubscription.php index 8f8e104..b0caff7 100755 --- a/src/Models/PlanSubscription.php +++ b/src/Models/PlanSubscription.php @@ -505,7 +505,7 @@ public function scopeGetByTag(Builder $builder, string $tag): Builder { return $builder->where('tag', $tag); } - + /** * Set new subscription period. * @@ -656,11 +656,13 @@ public function getFeatureUsage(string $featureTag): int * * @param string $featureTag * - * @return int + * @return int|null */ - public function getFeatureRemainings(string $featureTag): int + public function getFeatureRemainings(string $featureTag): ?int { - return $this->getFeatureValue($featureTag) - $this->getFeatureUsage($featureTag); + $featureValue = $this->getFeatureValue($featureTag); + + return (is_numeric($featureValue)) ? $featureValue - $this->getFeatureUsage($featureTag) : null; } /**