如何修复对 int 上的成员函数 where() 的调用

How to fix Call to a member function where() on int

我必须更新一些记录,但它不能正常工作。 有人知道怎么办吗?

$dog = DB::table('dogs')
    ->update($data)
    ->where('id', $id);

return 响应()->json($dog); })

update 之前调用 where,例如:

$dog = DB::table('dogs')->where('id', $id)->update($data);