I use many, many relationships. I want to set two values ββfor this attribute.
product,
attribute_product => product_id,attribute_id,value

I know this is wrong, but I want to show you what 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();
$table->primary(['product_id', 'attribute_id', 'devalue_id']);
});
Update 1
I need to set the sky, night
product_id attribute_id value devalue_id
1 1 sky 1
1 1 night 2
...
source
share