From b7c94ab7ab539b2f0386db6c4671915e2809a8c0 Mon Sep 17 00:00:00 2001 From: Salah Date: Tue, 4 Jul 2023 10:21:58 +0100 Subject: [PATCH 1/3] Laravel 10 Support --- composer.json | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index 0e83c90..8db7fb0 100644 --- a/composer.json +++ b/composer.json @@ -16,19 +16,19 @@ ], "require": { "php": "^8.1", - "illuminate/support": "^9.0", - "illuminate/console": "^9.0", - "illuminate/database": "^9.0", - "illuminate/broadcasting": "^9.0", - "illuminate/queue": "^9.0", - "illuminate/container": "^9.0" + "illuminate/support": "^9.0|^10.0", + "illuminate/console": "^9.0|^10.0", + "illuminate/database": "^9.0|^10.0", + "illuminate/broadcasting": "^9.0|^10.0", + "illuminate/queue": "^9.0|^10.0", + "illuminate/container": "^9.0|^10.0" }, "require-dev": { - "phpunit/phpunit": "^9.0", - "orchestra/testbench": "^7.1", - "pestphp/pest": "^1.21", - "pestphp/pest-plugin-laravel": "^1.2", - "pestphp/pest-plugin-mock": "^1.0", + "phpunit/phpunit": "^9.0|^10.1", + "orchestra/testbench": "^7.1|^8.5", + "pestphp/pest": "^1.21|2.8", + "pestphp/pest-plugin-laravel": "^1.2|^2.0", + "pestphp/pest-plugin-mock": "^1.0|^2.0", "nunomaduro/larastan": "^2.0" }, "autoload": { From e9f78697921f985a08a33443817cf86db54de4b1 Mon Sep 17 00:00:00 2001 From: Salah Elabbar <33955172+Elshaden@users.noreply.github.com> Date: Sun, 26 Nov 2023 18:29:34 +0100 Subject: [PATCH 2/3] fix decrementing usages_left when promo is unlimited fix decrementing usages_left when promo is unlimited --- src/Promocodes.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Promocodes.php b/src/Promocodes.php index f97d578..76c8650 100644 --- a/src/Promocodes.php +++ b/src/Promocodes.php @@ -251,7 +251,9 @@ public function apply(): ?PromocodeContract event(new GuestAppliedPromocode($this->promocode)); } - $this->promocode->decrement('usages_left'); + if (!$this->promocode->isUnlimited()) { + $this->promocode->decrement('usages_left'); + } return $this->promocode; } From ffa708584b13434106a6788c3792235ccff27906 Mon Sep 17 00:00:00 2001 From: Salah Elabbar <33955172+Elshaden@users.noreply.github.com> Date: Sun, 26 Nov 2023 19:21:30 +0100 Subject: [PATCH 3/3] Fixed Spacing --- src/Promocodes.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Promocodes.php b/src/Promocodes.php index 76c8650..1f507ca 100644 --- a/src/Promocodes.php +++ b/src/Promocodes.php @@ -251,11 +251,11 @@ public function apply(): ?PromocodeContract event(new GuestAppliedPromocode($this->promocode)); } - if (!$this->promocode->isUnlimited()) { + if (!$this->promocode->isUnlimited()) { $this->promocode->decrement('usages_left'); } - return $this->promocode; + return $this->promocode; } /**