1. Go to this page and download the library: Download slim-gee/dbcart-laravel 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/ */
slim-gee / dbcart-laravel example snippets
$cart = app('cart'); //using app() helper
$cart = App::make('cart');
use NabeelAlalmai\DBcart\Models\Cart;
//...
$cart = Cart::current();
use NabeelAlalmai\DBcart\Models\Cart;
// get carts based on their status: active/expired/pending/complete
$active_carts = Cart::active()->get();
$expired_carts = Cart::expired()->get();
$pending_carts = Cart::pending()->get();
$completed_carts = Cart::completed()->get();
namespace App;
use NabeelAlalmai\DBcart\Models\Cart as BaseCart;
class Cart extends BaseCart
{
//override or add your methods here ...
public function getSubTotalAttribute(){
return $this->attributes['total_price'];
}
public function getGrandTotalAttribute(){
//taking discount, tax etc. into account
return $this->sub_total - $this->discount;
}
}