App\Http\Controllers\ProductController::update PHP Method

update() public method

public update ( $publicId ) : Illuminate\Http\RedirectResponse
$publicId
return Illuminate\Http\RedirectResponse
    public function update($publicId)
    {
        return $this->save($publicId);
    }

Usage Example

 public function productDetail($id, $name)
 {
     $product = ProductController::getProductWhereID($id);
     //return $product;
     $productMaxView = ProductController::getproductMaxView();
     $info = InfoController::getInfo();
     $product[0]->view += 1;
     $data[0] = $product[0];
     $tag = TagController::getTag();
     //$data =array("id","name","promotion_price","price","image","quantity","status","icon_status","user","view","categoryID","menuID","tab_categoryID","created_at");
     ProductController::update($data, $id);
     /////update view
     $detailproduct = DetailProductController::getDetailProduct($id);
     $ads = AdsController::getAdsWhereType(1);
     $menu = MenuController::getMenu();
     $categorys = CategoryController::getCategory();
     $header = array("title" => $product[0]->name, "keyword" => $product[0]->name, "description" => $product[0]->name);
     if (count($menu) > 0) {
         $menu = $this->ConvertMenuToArray($menu);
     } else {
         $menu = array();
     }
     if (count($product) > 0 && count($detailproduct) > 0) {
         $category = $categorys[0];
         foreach ($categorys as $values) {
             if ($values->id == $product[0]->categoryID) {
                 $category = $values;
                 break;
             }
         }
         //return $category['name'];
         $relatedproducts = ProductController::getProductWhereCategoryID($product[0]->categoryID, $product[0]->id);
         $convert = new convertString();
         return view('product.detail-product', array("menu" => $menu, "product" => $product, "detailproduct" => $detailproduct, "relatedproducts" => $relatedproducts, "convert" => $convert, "category" => $category, "categorys" => $categorys, "ads" => $ads, "info" => $info, "productMaxView" => $productMaxView, "header" => $header, "tag" => $tag));
     } else {
         $header["title"] = "Không tìm thấy sản phẩm";
         return view('product.error', array("menu" => $menu, "categorys" => $categorys, "info" => $info, "header" => $header, "tag" => $tag));
     }
 }