mardi 5 mars 2019

Insertion problem of unique ID row in laravel

I am trying to insert some csv data to a table named tuhanorder. I want to insert only those row whose orderbango is not inserted previously. here is my code

$orderhenkan=tuhanorder::firstOrCreate(['orderbango' => $orderbango],
                         ['juchukubun2'=> 'ヤマト運輸'],
                         ['soufusakibango'=> $syukkosakibango],
                         ['chumonsyabango'=>(!empty($thanerjonno))],
                         ['money2'=>(!empty($answers[$i]['int17']))],
                         ['money3'=>(!empty($answers[$i]['int18']))],
                         ['money5'=>(!empty($answers[$i]['int19']))],
                         ['money4'=>(!empty($answers[$i]['int31']))],
                         ['moneymax'=>(!empty($answers[$i]['int30']))],
                         ['otodokedate'=>(!empty($answers[$i]['int22']))],
                         ['youbou'=> $answers[$i]['int20']],
                         ['chumonsyajouhou'=> $answers[$i]['int21']],
                         ['otodoketime'=> $answers[$i]['int23']],
                         ['information4'=> $answers[$i]['int24']],
                         ['kessaihouhou'=> $answers[$i]['int25']],
                         ['juchubango'=> $answers[$i]['int0']],
                         ['chumondate'=> $answers[$i]['int1']],
                         ['information5'=>$answers[$i]['int2']],
                         ['juchukubun1'=> $answers[$i]['int10']]);

My code is working. But it is only inserting first two elements. Rest are null in database.I am using postgresql as database.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire