LukePOLO\LaraCart\Traits\CouponTrait::checkValidTimes PHP Method

checkValidTimes() public method

Checks to see if the times are valid for the coupon.
public checkValidTimes ( Carbon\Carbon $startDate, Carbon\Carbon $endDate, $throwErrors = true ) : boolean
$startDate Carbon\Carbon
$endDate Carbon\Carbon
$throwErrors
return boolean
    public function checkValidTimes(Carbon $startDate, Carbon $endDate, $throwErrors = true)
    {
        if (Carbon::now()->between($startDate, $endDate)) {
            return true;
        } else {
            if ($throwErrors) {
                throw new CouponException('This coupon has expired');
            } else {
                return false;
            }
        }
    }