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": { diff --git a/src/Promocodes.php b/src/Promocodes.php index f97d578..6d34cdf 100644 --- a/src/Promocodes.php +++ b/src/Promocodes.php @@ -251,7 +251,10 @@ 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; }