I'm getting a row form the table and try to update like this;
{
$db_dw = \DB::connection('sqlsrvdw');
$factAlarm= $db_dw->table('ALARM')->where([['AlarmId',$id],['MostRecentFlag',1]])->first();
print_r($factAlarm); --->This prints my row
$this->updateFactAlarm($factAlarm);
-----------------
}
private function updateFactAlarm($factAlarm){
$factAlarm->AlarmActionDescription= request('ackNotes');
$factAlarm->IsAcknowledged = 1;
$factAlarm->update();
}
I get following error
Call to undefined method stdClass::update()
Even if I use save() method I get same error
Call to undefined method stdClass::save()
What is wrong with my approach?
DB::table('table_name')->where(----)->update([-----]);
? – Sagar Gautam