Пример #1
0
 private function addorupdateProductCategories($data, $postedData)
 {
     $prodcutid = $data->id;
     $cats = $postedData->categories;
     $this->deleteProductCategoriesByPrdId($prodcutid);
     foreach($cats as $cat)
     {
         if(!is_null($cat->id))
         {
            $attributes = array(
                    "product_id" => $prodcutid,
                    "category_id" => $cat->id
                    );
            $data = \Productcategory::create($attributes);
         }
     }
 }