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

20 lines
402 B
PHP

<?php
namespace Modules\Coupon\Checkers;
use Closure;
use Modules\Cart\Facades\Cart;
use Modules\Coupon\Exceptions\CouponAlreadyAppliedException;
class AlreadyApplied
{
public function handle($coupon, Closure $next)
{
if (Cart::couponAlreadyApplied($coupon)) {
throw new CouponAlreadyAppliedException;
}
return $next($coupon);
}
}