'update existing table rows with an array data

I am trying to update a table column with form data.

The form will pass the values in the form of an array as shown below.

enter image description here

Now I need to fill the existing table with data from the array. Something like first data into the first row.

        $infos = data::where('name', '=', 'abc')->select('*')
                ->orderBy('id')->get();

        $i = 0;
        while($i < count($infos)){
            foreach ($infos as $info) {
                $info[$i]->subject = $request->subject[$i] ? $request->subject[$i] : null;
                $info->save();
            } 
        }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source