1. Go to this page and download the library: Download mykholy/shopping-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/ */
mykholy / shopping-cart example snippets
use Illuminate\Database\Eloquent\Model;
use Mykholy\ShoppingCart\Buyable;
use Mykholy\ShoppingCart\BuyableTrait;
class Product extends Model implements Buyable
{
use BuyableTrait;
}
use Mykholy\ShoppingCart\Taxable;
class Product extends Model implements Buyable, Taxable
{
/**
* Calculate the tax here based on a database column, or whatever you will.
*
* @return int|float
*/
public function getTaxRate()
{
if ($this->tax_rate) {
return $this->tax_rate;
}
if (! $this->taxable) {
return 0;
}
return 8;
}