I am using many to many relation. i want to set two value for this attribute.
product,
attributes,
attribute_product => product_id,attribute_id,value
I know it's wrong , but I want to show you that i want
$product->attributes()->sync([
1 => [
'value' => 'sky'
],
1 => [
'value' => 'night'
],
]);
Update 2
Schema::create('attribute_product', function (Blueprint $table) {
$table->unsignedInteger('product_id');
$table->unsignedInteger('attribute_id');
$table->text('value')->nullable();
$table->integer('devalue_id')->nullable(); // value id
$table->primary(['product_id', 'attribute_id', 'devalue_id']);
});
Update 1
I need to set sky,night
product_id attribute_id value devalue_id
1 1 sky 1
1 1 night 2
...
