i'm trying to save or update, when retrivieng mutliple records, but can't get it work..
When doing this, at first it look like it worked:
$c = Customer::select('Name', 'City');
$c[0]->update(array('Name' => 'new Name'));
var_dump($c[0]['Name']);
But after a refresh and test it like that, i still see the oldname:
$c = Customer::select('Name', 'City');
var_dump($c[0]['Name']);
Somebody knows what i'm doing wrog?
i Have retrieve a json thing:
data[0][Name]:Afrifield Corporation
data[0][City]:Maidstone
data[1][Name]:Amann Informatik AG
data[1][City]:Reinach BL
data[2][Name]:Antarcticopy
data[2][City]:Antwerpen
if also have the columns Name and City which i want to update with this retrieved array..
so last question there is no faster solution than:
$custNo = Customer::select('Name', 'No_')->get();
for ($i = 0; $i < count($custNo); $i++) {
$c = Customer::select('Name', 'City')->where('No_','=',$custNo[$i]->No_);
$c->update(array('Name' => $input['data'][$i]['Name']));
}
No_ is my PrimaryKey i also set this in the model class..