Question : laravel model update table
Answered by : akbarali
$post = Post::find(3);
$post->title = "Updated title";
$post->save();
or $affectedRows = Post::where("id", 3)->update(["title" => "Updated title"]);
Source : https://stackoverflow.com/questions/29594572/laravel-eloquent-update-record-without-loading-from-database | Last Update : Fri, 08 Oct 21
Question : laravel model update
Answered by : christian-racuya
Model::where('id',1)->update(['name'=>'updated name']);
//or
$data = Model::findOrFail($id); //primary id
$data->name = $request->input('updated name');
$data->save();
Source : https://stackoverflow.com/questions/29594572/laravel-eloquent-update-record-without-loading-from-database | Last Update : Tue, 07 Jun 22
Question : laravel model update table
Answered by : akbarali
ModelName::whereId($id)->update($request->all());
Source : | Last Update : Mon, 09 Aug 21