From 779b54ca009393c9749ca6bf75165553015a85a6 Mon Sep 17 00:00:00 2001 From: Tyler Arbon Date: Fri, 24 Aug 2018 10:55:46 -0600 Subject: [PATCH] - Fixed deallocation issue --- CHANGELOG.md | 3 +++ src/License.php | 8 ++------ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dbe6bd..7499ec1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,9 @@ All notable changes to `laravel-licenser` will be documented in this file. +### 4.0.1 +- Fixed deallocation issue + ### 4.0.0 - Deallocation logic diff --git a/src/License.php b/src/License.php index 2e7f07b..feaaecc 100644 --- a/src/License.php +++ b/src/License.php @@ -104,12 +104,8 @@ public function allocate($quantity, $add = false) public function deallocate($quantity, $sub = false) { $used = $this->used(); - if ($used - $quantity >= 0) { - if(!$sub) { - $this->error($this->deallocateMessage($used, $quantity)); - } else { - $this->sub($quantity); - } + if ($used - $quantity >= 0 && $sub) { + $this->sub($quantity); } $this->deallocateSuccess($quantity);