PHP code example of lenius / laravel-basket

1. Go to this page and download the library: Download lenius/laravel-basket library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lenius / laravel-basket example snippets


//Format array of 'id'       => 1,
	'name'     => 'Dog',
	'price'    => 120.00,
	'quantity' => 1,
	'weight'   => 200
);

//Make the insert...
Basket::insert(new Item($items));

//Let's see what we have got in their...
dd(Basket::totalItems());

Basket::insert(new Item(array(
    'id'       => 'mouseid',
    'name'     => 'Mouse',
    'price'    => 100,
    'quantity' => 1,
    'tax'      => 25,
    'weight'   => 200
)));

foreach (Basket::contents() as $item) {
    $item->name = 'Foo';
    $item->quantity = 1;
}

foreach (Basket::contents() as $item) {
    $item->remove();
}

Basket::destroy()

Basket::contents();

Basket::contents(true);

Basket::totalItems();

Basket::totalItems(true);

$Basket->total();

Basket::total(false);

Basket::has($itemIdentifier);

Basket::item($itemIdentifier);

Basket::total();

Basket::total(false);

if ($item->hasOptions()) {
    // We have options
}

$item->remove();

$item->weight();

$item->toArray();
bash 
$ php artisan make:auth
$ php artisan make:ecommerce