Example #1
0
 /**
  * 0 = A to Z
  * 1 = Z to A
  * 2 = Stock Asc
  * 3 = Stock desc
  * 4 = Show out of stock only
  *
  * @param $sorttype
  * @return $this
  */
 public function sort($sorttype)
 {
     Session::put("sort_type", $sorttype);
     $product = Product::leftJoin('inventories', 'products.id', '=', 'inventories.product_id');
     $products = $this->sortInventory($product, $sorttype);
     return view('dashboard/inventory')->with('products', $products->paginate(20))->with('sorttype', $sorttype);
 }
 /**
  * Search product from POS
  * @param string $code
  */
 public function searchProdctByCodeWidthDiscount()
 {
     $code = Input::get('codeNumber');
     $customer_id = Input::get('customer_id');
     $products = Product::leftJoin('pricing_rules', function ($join) use($customer_id) {
         $join->on('pricing_rules.product_id', '=', 'products.id')->where('pricing_rules.customer_id', "=", $customer_id);
     })->where('products.is_active', 1)->where('code', $code)->first();
     return Response::json($products);
 }