mardi 15 mars 2016

how to insert looping variable data in laravel insert query

I got the o/p like below

["1-7","2-7","1-8","2-8","1-9","2-9"]

How can i insert the above data into db using foreach.

foreach ($final_valuee as $key => $value_rel) {

                        ProductCode::insert([
                        'product_id'=>'1',
                        'attribute_value_id'=>$value_rel,
                        'product_code'=>'1',
                        'status'=>'1',
                        'deletestatus'=>'0',
                        'created_at'=>date('Y:m:d H:i:s'),
                        'updated_at'=>date('Y:m:d H:i:s')
                    ]);
                    }

In that the data inserted into wrongly like below... 1 2 1 2 1 2



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire