|
@@ -201,26 +201,16 @@ class ProductController extends Controller
|
|
|
public function uploadValAttribute(Request $request)
|
|
|
{
|
|
|
$productID = $request->productID;
|
|
|
+// dd( [$request->val_attribute]);
|
|
|
$product = Product::where('id', $productID)->first();
|
|
|
$attributes = [];
|
|
|
- foreach ( $request->val_attribute as $attr_id => $values ){
|
|
|
- $attributes[$attr_id] = ['val_attribute' => $values];
|
|
|
+ foreach ( [$request->val_attribute] as $attr_id => $values ){
|
|
|
+ $attributes[ $attr_id ] = ['val_attribute' => $values];
|
|
|
|
|
|
}
|
|
|
-// dd( $attributes );
|
|
|
- $product->attributes()->sync( $attributes );
|
|
|
- dd( $attributes );
|
|
|
- foreach ( $request->val_attribute as $attr_id => $values ){
|
|
|
- $values = array_values( $values );
|
|
|
- echo $attr_id . ' ';
|
|
|
- var_dump( $values );
|
|
|
- echo "<hr>";
|
|
|
-
|
|
|
- }
|
|
|
- dd();
|
|
|
- $product->attributes()->sync($request->val_attribute);
|
|
|
- dd(1);
|
|
|
-
|
|
|
+// dd($attributes);
|
|
|
+ $product->attributes()->sync($attributes);
|
|
|
+dd($attributes);
|
|
|
// if ((!$attributables->attribute_id='attribute_id' && !$attributables->attributable_id='attributable_id')){
|
|
|
// foreach ($info as $item){
|
|
|
// $data = [
|