Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

laravel model create array

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'] ?? [],
                    ]);
                }
            }
 
PREVIOUS NEXT
Tagged: #laravel #model #create #array
ADD COMMENT
Topic
Name
6+9 =