Свойство | Type | Description | |
---|---|---|---|
$event | Illuminate\Contracts\Events\Dispatcher | Event dispatcher. | |
$model | string | Associated model name. | |
$name | string | Current cart name. | |
$session | Illuminate\Session\SessionManager | Session manager. |
Méthode | Description | |
---|---|---|
__construct ( Illuminate\Session\SessionManager $session, Illuminate\Contracts\Events\Dispatcher $event ) | Constructor. | |
add ( integer | string $id, string $name = null, integer $qty = null, float $price = null, array $attributes = [] ) : string | Add a row to the cart. | |
all ( ) : |
Get all items. | |
associate ( string $model ) : |
Associated model. | |
clean ( ) : boolean | Alias of destory(). | |
count ( boolean $totalItems = true ) : integer | Get the number of items in the cart. | |
countRows ( ) : integer | Get rows count. | |
destroy ( ) : boolean | Clean the cart. | |
get ( string $rawId ) : |
Get a row of the cart by its ID. | |
getModel ( ) : string | Get current associated model. | |
getName ( ) : string | Get current cart name. | |
isEmpty ( ) : boolean | Return whether the shopping cart is empty. | |
name ( string $name ) : |
Set the current cart name. | |
remove ( string $rawId ) : boolean | Remove a row from the cart. | |
search ( array $search ) : array | Search if the cart has a item. | |
total ( ) : float | Get the price total. | |
totalPrice ( ) | Return total price of cart. | |
update ( string $rawId, integer | array $attribute ) : |
Update the quantity of one row of the cart. |
Méthode | Description | |
---|---|---|
addRow ( string $id, string $name, integer $qty, float $price, array $attributes = [] ) : string | Add row to the cart. | |
generateRawId ( string $id, array $attributes ) : string | Generate a unique id for the new row. | |
getCart ( ) : |
Get the carts content. | |
insertRow ( string $rawId, string $id, string $name, integer $qty, float $price, array $attributes = [] ) : |
Create a new row Object. | |
makeRow ( string $rawId, mixed $id, string $name, integer $qty, float $price, array $attributes = [] ) : |
Make a row item. | |
save ( |
Sync the cart to session. | |
updateAttribute ( string $rawId, array $attributes ) : |
Update an attribute of the row. | |
updateQty ( string $rawId, integer $qty ) : |
Update the quantity of a row. | |
updateRow ( string $rawId, array $attributes ) : |
Update a row if the rawId already exists. |
public __construct ( Illuminate\Session\SessionManager $session, Illuminate\Contracts\Events\Dispatcher $event ) | ||
$session | Illuminate\Session\SessionManager | Session class name |
$event | Illuminate\Contracts\Events\Dispatcher | Event class name |
public add ( integer | string $id, string $name = null, integer $qty = null, float $price = null, array $attributes = [] ) : string | ||
$id | integer | string | Unique ID of the item |
$name | string | Name of the item |
$qty | integer | Item qty to add to the cart |
$price | float | Price of one item |
$attributes | array | Array of additional attributes, such as 'size' or 'color'... |
Résultat | string |
protected addRow ( string $id, string $name, integer $qty, float $price, array $attributes = [] ) : string | ||
$id | string | Unique ID of the item |
$name | string | Name of the item |
$qty | integer | Item qty to add to the cart |
$price | float | Price of one item |
$attributes | array | Array of additional options, such as 'size' or 'color' |
Résultat | string |
public all ( ) : |
||
Résultat |
protected getCart ( ) : |
||
Résultat |
protected insertRow ( string $rawId, string $id, string $name, integer $qty, float $price, array $attributes = [] ) : |
||
$rawId | string | The ID of the new row |
$id | string | Unique ID of the item |
$name | string | Name of the item |
$qty | integer | Item qty to add to the cart |
$price | float | Price of one item |
$attributes | array | Array of additional options, such as 'size' or 'color' |
Résultat |
protected updateAttribute ( string $rawId, array $attributes ) : |
||
$rawId | string | The ID of the row |
$attributes | array | An array of attributes to update |
Résultat |
protected Dispatcher,Illuminate\Contracts\Events $event | ||
Résultat | Illuminate\Contracts\Events\Dispatcher |