FleetCart/Modules/Coupon/Checkers/UsageLimitPerCustomer.php
2023-06-11 13:14:03 +01:00

19 lines
387 B
PHP

<?php
namespace Modules\Coupon\Checkers;
use Closure;
use Modules\Coupon\Exceptions\CouponUsageLimitReachedException;
class UsageLimitPerCustomer
{
public function handle($coupon, Closure $next)
{
if ($coupon->perCustomerUsageLimitReached()) {
throw new CouponUsageLimitReachedException;
}
return $next($coupon);
}
}