/** * [saveEditInfomation description] * @param [type] $product_id [description] * @param [type] $content [description] * @param [type] $product_name [description] * @return [type] [description] */ public static function saveEditInfomation($product_id, $content, $product_name) { $update = ProductInfomation::whereProduct_id($product_id)->update(array('value' => $content, 'name_product' => $product_name)); return; }
/** * @return mixed */ public function deleteProduct() { $value = Product::whereId(Input::get('product_id'))->first(); $images = ProductImage::whereProduct_id(Input::get('product_id'))->get(); $this->deleteImage($value['image'], 'lib/images/products/default-product.jpg'); $this->deleteImage($value['image_small'], 'lib/images/products/default-small.jpg'); $value->delete(); ProductInfomation::whereProduct_id(Input::get('product_id'))->delete(); foreach ($images as $item) { $this->deleteImage($item->image, 'lib/images/products/default-product-gallery.jpg'); $this->deleteImage($item->image_small, 'lib/images/products/default-gallery-thumb.jpg'); $item->delete(); } Session::flash('success', 'Xoa Thanh Cong !'); return Redirect::back(); }