My request data represents an array of new and existing items. I'm trying to through this array to update and create items.
This is how I retrieve the array:
$userInput = $request->all();
foreach( $userInput['items'] as $key=>&$item){
Later in the code I update an existing item:
$updateItem = Item::find($item['id']);
$updateItem->number = $item['number'];
$updateItem->save();
But $item['number'] seems to contain old input from previous updates and not the value I entered last time.
How can I loop through request data in Laravel ?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2laPTsv
via IFTTT
Aucun commentaire:
Enregistrer un commentaire