增加onlyTrashed方法

This commit is contained in:
thinkphp
2016-08-06 11:53:07 +08:00
parent 9441d10d67
commit fb66950ded

View File

@@ -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