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;
}
}
}