要从表中获取所有行,我必须使用 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();
结果中仅软删除模型
$onlySoftDeleted = Model::onlyTrashed()->get();
这篇关于如何从 Laravel 的表中获取所有行(也被软删除)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!