PHP 클래스 LukePOLO\LaraCart\LaraCart

상속: implements LukePOLO\LaraCart\Contracts\LaraCartContract
파일 보기 프로젝트 열기: lukepolo/laracart 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$cart
$itemModel
$itemModelRelations
$prefix

보호된 프로퍼티들

프로퍼티 타입 설명
$authManager
$events
$session

공개 메소드들

메소드 설명
__construct ( Illuminate\Session\SessionManager $session, Illuminate\Contracts\Events\Dispatcher $events, Illuminate\Auth\AuthManager $authManager ) LaraCart constructor.
add ( $itemID, null $name = null, integer $qty = 1, string $price = '0.00', array $options = [], boolean | false $taxable = true, boolean | false $lineItem = false ) : CartItem Creates a CartItem and then adds it to cart.
addCoupon ( LukePOLO\LaraCart\Contracts\CouponContract $coupon ) Applies a coupon to the cart.
addFee ( $name, $amount, boolean | false $taxable = false, array $options = [] ) Allows to charge for additional fees that may or may not be taxable ex - service fee , delivery fee, tips.
addItem ( CartItem $cartItem ) : CartItem Adds the cartItem into the cart session.
addLine ( string | integer $itemID, null $name = null, integer $qty = 1, string $price = '0.00', array $options = [], boolean | true $taxable = true ) : CartItem Creates a CartItem and then adds it to cart.
count ( boolean $withItemQty = true ) : integer Get the count based on qty, or number of unique items.
decrement ( $itemHash ) : CartItem | null Decrement the quantity of a cartItem based on the itemHash.
destroyCart ( ) Completely destroys cart and anything associated with it.
emptyCart ( ) Empties the carts items.
feeTotals ( boolean $format = true, $withTax = false ) : string Gets all the fee totals.
find ( $data ) : array Find items in the cart matching a data set.
findCoupon ( $code ) : mixed Finds a specific coupon in the cart.
formatMoney ( $number, $locale = null, $internationalFormat = null, $format = true ) : string Formats the number into a money format based on the locale and international formats.
get ( string $instance = 'default' ) Gets the instance in the session.
getAttribute ( $attribute, $defaultValue = null ) : mixed Gets an an attribute from the cart.
getAttributes ( ) : mixed Gets all the carts attributes.
getCoupons ( ) : array Gets the coupons for the current cart.
getFee ( $name ) : mixed Gets a specific fee from the fees array.
getFees ( ) : mixed Gets all the fees on the cart object.
getInstances ( ) : mixed Gets all current instances inside the session.
getItem ( $itemHash ) : CartItem | null Finds a cartItem based on the itemHash.
getItems ( ) : array Gets all the items within the cart.
increment ( $itemHash ) : CartItem | null Increment the quantity of a cartItem based on the itemHash.
removeAttribute ( $attribute ) Removes an attribute from the cart.
removeCoupon ( $code ) Removes a coupon in the cart.
removeCoupons ( ) Removes all coupons from the cart.
removeFee ( $name ) Removes a fee from the fee array.
removeFees ( ) Removes all the fees set in the cart.
removeItem ( $itemHash ) Removes a CartItem based on the itemHash.
setAttribute ( $attribute, $value ) Adds an Attribute to the cart.
setInstance ( string $instance = 'default' ) : LaraCart Sets and Gets the instance of the cart in the session we should be using.
subTotal ( boolean $format = true, boolean $withDiscount = true ) : string Gets the subtotal of the cart with or without tax.
taxTotal ( boolean | true $format = true ) : string Gets the total tax for the cart.
total ( boolean $format = true, boolean $withDiscount = true, $withTax = true, $withFees = true ) : string Gets the total of the cart with or without tax.
totalDiscount ( boolean $format = true ) : string Gets the total amount discounted.
update ( ) Updates cart session.
updateItem ( $itemHash, $key, $value ) : CartItem Updates an items attributes.

비공개 메소드들

메소드 설명
getFromModel ( Model $itemModel, $attr, null $defaultValue = null ) : Model | null Gets a option from the model.
getItemModelOptions ( Model $itemModel, array $options = [] ) : array Gets the item models options based the config.
isItemModel ( $itemModel ) : boolean Checks to see if its an item model.
removeCouponFromItems ( null $code = null ) Removes a coupon from the item.

메소드 상세

__construct() 공개 메소드

LaraCart constructor.
public __construct ( Illuminate\Session\SessionManager $session, Illuminate\Contracts\Events\Dispatcher $events, Illuminate\Auth\AuthManager $authManager )
$session Illuminate\Session\SessionManager
$events Illuminate\Contracts\Events\Dispatcher
$authManager Illuminate\Auth\AuthManager

add() 공개 메소드

Creates a CartItem and then adds it to cart.
public add ( $itemID, null $name = null, integer $qty = 1, string $price = '0.00', array $options = [], boolean | false $taxable = true, boolean | false $lineItem = false ) : CartItem
$itemID
$name null
$qty integer
$price string
$options array
$taxable boolean | false
$lineItem boolean | false
리턴 CartItem

addCoupon() 공개 메소드

Applies a coupon to the cart.
public addCoupon ( LukePOLO\LaraCart\Contracts\CouponContract $coupon )
$coupon LukePOLO\LaraCart\Contracts\CouponContract

addFee() 공개 메소드

Allows to charge for additional fees that may or may not be taxable ex - service fee , delivery fee, tips.
public addFee ( $name, $amount, boolean | false $taxable = false, array $options = [] )
$name
$amount
$taxable boolean | false
$options array

addItem() 공개 메소드

Adds the cartItem into the cart session.
public addItem ( CartItem $cartItem ) : CartItem
$cartItem CartItem
리턴 CartItem

addLine() 공개 메소드

Creates a CartItem and then adds it to cart.
public addLine ( string | integer $itemID, null $name = null, integer $qty = 1, string $price = '0.00', array $options = [], boolean | true $taxable = true ) : CartItem
$itemID string | integer
$name null
$qty integer
$price string
$options array
$taxable boolean | true
리턴 CartItem

count() 공개 메소드

Get the count based on qty, or number of unique items.
public count ( boolean $withItemQty = true ) : integer
$withItemQty boolean
리턴 integer

decrement() 공개 메소드

Decrement the quantity of a cartItem based on the itemHash.
public decrement ( $itemHash ) : CartItem | null
$itemHash
리턴 CartItem | null | null

destroyCart() 공개 메소드

Completely destroys cart and anything associated with it.
public destroyCart ( )

emptyCart() 공개 메소드

Empties the carts items.
public emptyCart ( )

feeTotals() 공개 메소드

Gets all the fee totals.
public feeTotals ( boolean $format = true, $withTax = false ) : string
$format boolean
리턴 string

find() 공개 메소드

param $data
public find ( $data ) : array
리턴 array

findCoupon() 공개 메소드

Finds a specific coupon in the cart.
public findCoupon ( $code ) : mixed
$code
리턴 mixed

formatMoney() 공개 정적인 메소드

Formats the number into a money format based on the locale and international formats.
public static formatMoney ( $number, $locale = null, $internationalFormat = null, $format = true ) : string
$number
$locale
$internationalFormat
$format
리턴 string

get() 공개 메소드

Gets the instance in the session.
public get ( string $instance = 'default' )
$instance string

getAttribute() 공개 메소드

Gets an an attribute from the cart.
public getAttribute ( $attribute, $defaultValue = null ) : mixed
$attribute
$defaultValue
리턴 mixed

getAttributes() 공개 메소드

Gets all the carts attributes.
public getAttributes ( ) : mixed
리턴 mixed

getCoupons() 공개 메소드

Gets the coupons for the current cart.
public getCoupons ( ) : array
리턴 array

getFee() 공개 메소드

Gets a specific fee from the fees array.
public getFee ( $name ) : mixed
$name
리턴 mixed

getFees() 공개 메소드

Gets all the fees on the cart object.
public getFees ( ) : mixed
리턴 mixed

getInstances() 공개 메소드

Gets all current instances inside the session.
public getInstances ( ) : mixed
리턴 mixed

getItem() 공개 메소드

Finds a cartItem based on the itemHash.
public getItem ( $itemHash ) : CartItem | null
$itemHash
리턴 CartItem | null | null

getItems() 공개 메소드

Gets all the items within the cart.
public getItems ( ) : array
리턴 array

increment() 공개 메소드

Increment the quantity of a cartItem based on the itemHash.
public increment ( $itemHash ) : CartItem | null
$itemHash
리턴 CartItem | null | null

removeAttribute() 공개 메소드

Removes an attribute from the cart.
public removeAttribute ( $attribute )
$attribute

removeCoupon() 공개 메소드

Removes a coupon in the cart.
public removeCoupon ( $code )
$code

removeCoupons() 공개 메소드

Removes all coupons from the cart.
public removeCoupons ( )

removeFee() 공개 메소드

Removes a fee from the fee array.
public removeFee ( $name )
$name

removeFees() 공개 메소드

Removes all the fees set in the cart.
public removeFees ( )

removeItem() 공개 메소드

Removes a CartItem based on the itemHash.
public removeItem ( $itemHash )
$itemHash

setAttribute() 공개 메소드

Adds an Attribute to the cart.
public setAttribute ( $attribute, $value )
$attribute
$value

setInstance() 공개 메소드

Sets and Gets the instance of the cart in the session we should be using.
public setInstance ( string $instance = 'default' ) : LaraCart
$instance string
리턴 LaraCart

subTotal() 공개 메소드

Gets the subtotal of the cart with or without tax.
public subTotal ( boolean $format = true, boolean $withDiscount = true ) : string
$format boolean
$withDiscount boolean
리턴 string

taxTotal() 공개 메소드

Gets the total tax for the cart.
public taxTotal ( boolean | true $format = true ) : string
$format boolean | true
리턴 string

total() 공개 메소드

Gets the total of the cart with or without tax.
public total ( boolean $format = true, boolean $withDiscount = true, $withTax = true, $withFees = true ) : string
$format boolean
$withDiscount boolean
리턴 string

totalDiscount() 공개 메소드

Gets the total amount discounted.
public totalDiscount ( boolean $format = true ) : string
$format boolean
리턴 string

update() 공개 메소드

Updates cart session.
public update ( )

updateItem() 공개 메소드

Updates an items attributes.
public updateItem ( $itemHash, $key, $value ) : CartItem
$itemHash
$key
$value
리턴 CartItem

프로퍼티 상세

$authManager 보호되어 있는 프로퍼티

protected $authManager

$cart 공개적으로 프로퍼티

public $cart

$events 보호되어 있는 프로퍼티

protected $events

$itemModel 공개적으로 프로퍼티

public $itemModel

$itemModelRelations 공개적으로 프로퍼티

public $itemModelRelations

$prefix 공개적으로 프로퍼티

public $prefix

$session 보호되어 있는 프로퍼티

protected $session