PHP code example of marksihor / laravel-cart

1. Go to this page and download the library: Download marksihor/laravel-cart 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/ */

    

marksihor / laravel-cart example snippets


$ php artisan vendor:publish --provider="MarksIhor\\LaravelCart\\CartServiceProvider" --tag=config

  'Cart' => MarksIhor\LaravelCart\Facades\CartFacade::class,

  'cart' => \MarksIhor\LaravelCart\Http\Middleware\CartMiddleware::class,


\Cart::addItem([
            'product_id' => $product->id,
            'seller_id' => $product->user_id,
            'attributes' => $attributes,
            'price' => $product->price
        ]);
\Cart::getCart();
\Cart::getCart($cartId);
\Cart::getContentArray();
\Cart::getContentArray($cartId);
\Cart::getContent();
\Cart::getContent($cartId);
\Cart::deleteItem($itemId);
\Cart::clearCart();
\Cart::clearCart($itemId);
\Cart::getTotal($type); // price|total|discount|quantity
\Сart::getTotal($type, $cartId);
\Cart::updateItem($item, $data);