public maxDiscount ( $maxDiscount, $discount, $throwErrors = true ) : mixed | ||
$maxDiscount | ||
$discount | ||
$throwErrors | ||
Résultat | mixed |
public function maxDiscount($maxDiscount, $discount, $throwErrors = true)
{
if ($maxDiscount == 0 || $maxDiscount > $discount) {
return $discount;
} else {
if ($throwErrors) {
throw new CouponException('This has a max discount of ' . \App::make(\LukePOLO\Laracart\LaraCart::SERVICE)->formatMoney($maxDiscount));
} else {
return $maxDiscount;
}
}
}