PHP Class LukePOLO\LaraCart\CartItem

Inheritance: use trait LukePOLO\LaraCart\Traits\CartOptionsMagicMethodsTrait
Exibir arquivo Open project: lukepolo/laracart Class Usage Examples

Public Properties

Property Type Description
$couponInfo
$discount
$internationalFormat
$lineItem
$locale
$subItems

Protected Properties

Property Type Description
$itemHash
$itemModel
$itemModelRelations

Public Methods

Method Description
__construct ( $id, $name, integer $qty, string $price, array $options = [], boolean $taxable = true, boolean | false $lineItem = false ) CartItem constructor.
addSubItem ( array $subItem, boolean $autoUpdate = true ) : CartSubItem Adds an sub item to a item.
find ( $data ) : mixed Search for matching options on the item.
findSubItem ( $subItemHash ) : mixed Finds a sub item by its hash.
generateHash ( boolean $force = false ) : string Generates a hash based on the cartItem array.
getDiscount ( boolean $format = true ) : string Gets the discount of an item.
getHash ( ) : mixed Gets the hash for the item.
getModel ( ) Returns a Model.
price ( boolean $format = true, boolean $taxedItemsOnly = false ) : string Gets the price of the item with or without tax, with the proper format.
removeSubItem ( $subItemHash ) Removes a sub item from the item.
searchForSubItem ( $data ) : array A way to find sub items.
setModel ( $itemModel, array $relations = [] ) Sets the related model to the item.
subItemsTotal ( boolean $format = true, boolean $taxedItemsOnly = false ) : string Gets the totals for the options.
subTotal ( boolean $format = true, boolean $withDiscount = true, boolean $taxedItemsOnly = false ) : string Gets the sub total of the item based on the qty with or without tax in the proper format.
tax ( integer $amountNotTaxable ) : integer | mixed Gets the tax for the item.

Method Details

__construct() public method

CartItem constructor.
public __construct ( $id, $name, integer $qty, string $price, array $options = [], boolean $taxable = true, boolean | false $lineItem = false )
$id
$name
$qty integer
$price string
$options array
$taxable boolean
$lineItem boolean | false

addSubItem() public method

Adds an sub item to a item.
public addSubItem ( array $subItem, boolean $autoUpdate = true ) : CartSubItem
$subItem array
$autoUpdate boolean
return CartSubItem

find() public method

Search for matching options on the item.
public find ( $data ) : mixed
return mixed

findSubItem() public method

Finds a sub item by its hash.
public findSubItem ( $subItemHash ) : mixed
$subItemHash
return mixed

generateHash() public method

Generates a hash based on the cartItem array.
public generateHash ( boolean $force = false ) : string
$force boolean
return string itemHash

getDiscount() public method

Gets the discount of an item.
public getDiscount ( boolean $format = true ) : string
$format boolean
return string

getHash() public method

Gets the hash for the item.
public getHash ( ) : mixed
return mixed

getModel() public method

Returns a Model.
public getModel ( )

price() public method

Gets the price of the item with or without tax, with the proper format.
public price ( boolean $format = true, boolean $taxedItemsOnly = false ) : string
$format boolean
$taxedItemsOnly boolean
return string

removeSubItem() public method

Removes a sub item from the item.
public removeSubItem ( $subItemHash )
$subItemHash

searchForSubItem() public method

A way to find sub items.
public searchForSubItem ( $data ) : array
$data
return array

setModel() public method

Sets the related model to the item.
public setModel ( $itemModel, array $relations = [] )
$itemModel
$relations array

subItemsTotal() public method

Gets the totals for the options.
public subItemsTotal ( boolean $format = true, boolean $taxedItemsOnly = false ) : string
$format boolean
$taxedItemsOnly boolean
return string

subTotal() public method

Gets the sub total of the item based on the qty with or without tax in the proper format.
public subTotal ( boolean $format = true, boolean $withDiscount = true, boolean $taxedItemsOnly = false ) : string
$format boolean
$withDiscount boolean
$taxedItemsOnly boolean
return string

tax() public method

Gets the tax for the item.
public tax ( integer $amountNotTaxable ) : integer | mixed
$amountNotTaxable integer
return integer | mixed

Property Details

$couponInfo public_oe property

public $couponInfo

$discount public_oe property

public $discount

$internationalFormat public_oe property

public $internationalFormat

$itemHash protected_oe property

protected $itemHash

$itemModel protected_oe property

protected $itemModel

$itemModelRelations protected_oe property

protected $itemModelRelations

$lineItem public_oe property

public $lineItem

$locale public_oe property

public $locale

$subItems public_oe property

public $subItems