Laravel如何更新多个id值

时间:2018-05-03 12:37:13

标签: laravel-5

Laravel如何更新表中的多个id值

print_r($test); exit();
Array ( [0] => 185 [1] => 216 )
$report = Test::find($test);
$report->status = "A";
$report->save();

1 个答案:

答案 0 :(得分:3)

Test::whereIn('id', $test)->update(['status' => "A"]);
祝你好运