diff --git a/library/traits/model/SoftDelete.php b/library/traits/model/SoftDelete.php index ee120ae5..854a55fe 100644 --- a/library/traits/model/SoftDelete.php +++ b/library/traits/model/SoftDelete.php @@ -44,6 +44,17 @@ trait SoftDelete return $model->db(); } + /** + * 只查询软删除数据 + * @access public + * @return \think\db\Query + */ + public static function onlyTrashed() + { + $model = new static(); + return $model->db()->where(static::$deleteTime, '>', 0); + } + /** * 删除当前的记录 * @access public