Esempio n. 1
0
 /**
  * Returns the active cart
  * @return  Bedard\Shop\Models\Cart
  */
 public function getActiveCart()
 {
     if (!($cookie = Cookie::get('bedard_shop_cart'))) {
         return false;
     }
     return CartModel::where('key', $cookie['key'])->whereNull('order_id')->with('items.inventory.product.discounts')->with('items.inventory.product.categories.discounts')->with(['items' => function ($items) {
         $items->inCart();
     }])->find($cookie['id']);
 }
Esempio n. 2
0
 /**
  * Returns the full cart with it's relationships
  * @return  Bedard\Shop\Models\Cart
  */
 public function loadDetailedCart()
 {
     if (!($cookie = Cookie::get('bedard_shop_cart'))) {
         return FALSE;
     }
     $cart = CartModel::where('key', $cookie['key'])->whereNull('order_id')->with('items.inventory.product.discounts')->with('items.inventory.product.categories.discounts')->with(['items' => function ($items) {
         $items->inCart();
     }])->find($cookie['id']);
     if ($cart && !is_null($cart->coupon_id)) {
         $cart->load('coupon');
     }
     return $cart;
 }