要从表中获取所有行,我必须使用 Model::all()
但是(有充分理由)这不会让我恢复软删除的行.有没有办法用 Eloquent 实现这一点?
To get all rows from a table, I have to use Model::all()
but (from good reason) this doesn't gives me back the soft deleted rows. Is there a way I can accomplish this with Eloquent?
同时获取软删除模型
$trashedAndNotTrashed = Model::withTrashed()->get();
您的结果中仅软删除模型
Only soft deleted models in your results
$onlySoftDeleted = Model::onlyTrashed()->get();
这篇关于如何从 Laravel 的表中获取所有行(也软删除)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!