1. Go to this page and download the library: Download nethask/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/ */
nethask / laravel-cart example snippets
'Moltin\Cart\CartServiceProvider',
'Cart' => 'Moltin\Cart\Facade',
// Format array of id' => 1,
'name' => 'Juicy Picnic Hamper',
'price' => 120.00,
'quantity' => 1
);
// Make the insert...
Cart::insert($items);
// Let's see what we have have in there...
dd(Cart::totalItems());
return array(
'storage' => 'session', //session, cache
// Cache
// Laravel documentation for more information
'cache_prefix' => 'moltin_cart_',
'cache_expire' => '-1', //in minutes, -1 permanent caching
// Identifier
// With a requestcookie (choose for storage: cache, the session will be expired), the cart could be reloaded from a http request, example: the customer could save his cart link (email, hyperlink) and reopen this later.
// If there is no request, the cookie will be loaded.
'identifier' => 'cookie', //cookie, requestcookie
//Request Cookie
'requestid' => 'CartID', //http input request identifier, example: your customer/backoffice could reload the cart in your shop controller, /public/shop?CartID=871f0bc18ca76e68bf7c3adf8f9426ef
);