dimanche 28 octobre 2018

Updating Data based on the ID

Here is the table data in an array. Fetched from user page

 array:5 [▼
 "_token" => "JkmBk6ozJ5NN3TMTobh48EH8MDlsjz7ER98d3mVH"
  "id" => array:2 [▼
   0 => "1"
   1 => "2"
  ]
  "locations" => array:2 [▼
    0 => "13.0717898,77.621292"
    1 => "13.0717898,77.621292"
  ]
  "location" => array:2 [▼
    0 => "Bangalore"
    1 => "Managalore"
  ]
  "submit" => "submit"
  ]

I just want to access the array data and Update the table based on the ID

Updation :

I want to replace the locations[0] lat/long value with the location[0]- Bangalore based on the ID

To be specific, I just want to replace all the Lat/long value present in locations array with the place fetched based on the user id.

Please help me with the Controller code.

Here is the code i which i have written to get the table data -

 @foreach ($data['Replocationdata'] as $key => $Replocationdata)
                 <tr id="Replocationdata">
                   <td><input type="hidden" 
 name="id[]" value="" /></td>
                   <td><input type="hidden" 
 name="locations[]" value="" /></td>
                   <td><input type="text" name="location[]" /></td>
                 </tr>
 @endforeach

And the Controller function

public function StorePlacename(Request $request)
{
  foreach ($request as $key => $temp) {
    echo($temp['id']);
  }
}

I want to get all these values from blade page (Array values) and access in StorePlacename method.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2AwvXcU
via IFTTT

Aucun commentaire:

Enregistrer un commentaire