如何更新 laravel 中 table 的软删除值
how to update soft deleted value from table in laravel
因为我已经完成了 link. 中提到的步骤。
请帮忙
在获取要编辑的数据时尝试使用 withTashed()。
// suppose user with id 2 is soft deleted.
eg: User::find(2) // this will return null and you won't be able to update the user
要获取软删除的用户,您应该使用 withTrashed()
eg: User::withTrashed()->find(2)->update(['deleted_at' => null);
Or User::withTrashed()->find(2)->restore();
因为我已经完成了 link.
在获取要编辑的数据时尝试使用 withTashed()。
// suppose user with id 2 is soft deleted.
eg: User::find(2) // this will return null and you won't be able to update the user
要获取软删除的用户,您应该使用 withTrashed()
eg: User::withTrashed()->find(2)->update(['deleted_at' => null);
Or User::withTrashed()->find(2)->restore();