PHP Trait LukePOLO\LaraCart\Traits\CouponTrait

Inheritance: use trait CartOptionsMagicMethodsTrait
Datei anzeigen Open project: lukepolo/laracart

Public Properties

Property Type Description
$appliedToCart boolean

Public Methods

Method Description
canApply ( ) : boolean Checks to see if we can apply the coupon.
checkMinAmount ( $minAmount, $throwErrors = true ) : boolean Checks the minimum subtotal needed to apply the coupon.
checkValidTimes ( Carbon\Carbon $startDate, Carbon\Carbon $endDate, $throwErrors = true ) : boolean Checks to see if the times are valid for the coupon.
getFailedMessage ( ) : null | string Gets the failed message for a coupon.
getMessage ( ) : string Get the reason why a coupon has failed to apply.
maxDiscount ( $maxDiscount, $discount, $throwErrors = true ) : mixed Returns either the max discount or the discount applied based on what is passed through.
setDiscountOnItem ( CartItem $item, $discountAmount ) Sets a discount to an item with what code was used and the discount amount.
setOptions ( $options ) Sets all the options for the coupon.

Method Details

canApply() public method

Checks to see if we can apply the coupon.
public canApply ( ) : boolean
return boolean

checkMinAmount() public method

Checks the minimum subtotal needed to apply the coupon.
public checkMinAmount ( $minAmount, $throwErrors = true ) : boolean
$minAmount
$throwErrors
return boolean

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

getFailedMessage() public method

Gets the failed message for a coupon.
public getFailedMessage ( ) : null | string
return null | string

getMessage() public method

Get the reason why a coupon has failed to apply.
Deprecation: 1.3
public getMessage ( ) : string
return string

maxDiscount() public method

Returns either the max discount or the discount applied based on what is passed through.
public maxDiscount ( $maxDiscount, $discount, $throwErrors = true ) : mixed
$maxDiscount
$discount
$throwErrors
return mixed

setDiscountOnItem() public method

Sets a discount to an item with what code was used and the discount amount.
public setDiscountOnItem ( CartItem $item, $discountAmount )
$item LukePOLO\LaraCart\CartItem
$discountAmount

setOptions() public method

Sets all the options for the coupon.
public setOptions ( $options )
$options

Property Details

$appliedToCart public_oe property

public bool $appliedToCart
return boolean