FleetCart/Modules/Coupon/Checkers/AlreadyApplied.php

20 lines
402 B
PHP
Raw Normal View History

2023-06-11 12:14:03 +00:00
<?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);
}
}