mercredi 1 juin 2016

update multiple array values with multiple ids in laravel 5.1

My query as follows

        $dueid = array('1','2');

        for($n = 0; $n< count($post['percentage']); $n++) {

            $due=invoiceduedates::whereIn('id',$dueid)
            ->update(array(
            'percentage' => $post['percentage'][$n],
            'amount'=>$post['pamount'][$n],
            'date' => $post['date'][$n]

            )
            );

        }

But in table,at 1st and 2nd ids the 2nd array data is getting updated.Please help me to sort it out.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire