Example #1
0
 /**
  * [saveProduct description]
  * @param  [type] $array [description]
  * @param  [type] $img   [description]
  * @return [type]        [description]
  */
 public static function saveProduct($array, $img, $img_small)
 {
     $value = array('name' => $array['name'], 'description' => $array['description'], 'quantity' => $array['quantity'], 'price' => $array['price'], 'price_sale' => $array['sale'], 'price_bestsaller' => $array['bestsaller'], 'rate' => $array['rate'], 'slug' => Str::slug($array['name']), 'block' => $array['block']);
     if ($img != null) {
         $value['image'] = $img;
         $value['image_small'] = $img_small;
     }
     $update = Product::whereId($array['hidden_product_id'])->update($value);
     return;
 }
 public function getItem($type, $itemID)
 {
     switch ($type) {
         case 'categories':
             $item = Category::whereId($itemID)->get(array('id', 'name'))->first();
             break;
         default:
             $item = Product::whereId($itemID)->get(array('id', 'name', 'slug', 'pricing', 'in_stock', 'published', 'short_description', 'long_description'))->first();
             break;
     }
     return $item;
 }
 public function getItem($type, $itemID)
 {
     switch ($type) {
         case 'categories':
             $item = Category::whereId($itemID)->get(array('id', 'name'))->first();
             break;
         default:
             $item = Product::whereId($itemID)->get(array('id', 'name'))->first();
             break;
     }
     return $item;
 }
Example #4
0
 /**
  * @return mixed
  */
 public function activeProduct()
 {
     $disable = Product::whereId(Input::get('product_id'))->update(array('block' => 1));
     Session::flash('success', 'Active Thanh Cong !');
     return Redirect::back();
 }