model laravel membuat array
$data = [
['name'=>'Coder 1', 'rep'=>'4096'],
['name'=>'Coder 2', 'rep'=>'2048'],
//...
];
Coder::insert($data);
Shadow
$data = [
['name'=>'Coder 1', 'rep'=>'4096'],
['name'=>'Coder 2', 'rep'=>'2048'],
//...
];
Coder::insert($data);
if (isset($rq['product_attribute']) && count($rq['product_attribute']) > 0) {
foreach ($rq['product_attribute'] as $key => $value) {
ProductAttributesModel::create([
'product_id' => $product_id,
'attribute_id' => $value['attribute_id'],
'text' => $value['text'] ?? [],
]);
}
}