From f99a0dd536bcd378cf5bed8aa85da1d4e00593de Mon Sep 17 00:00:00 2001 From: thinkphp Date: Sat, 13 Aug 2016 21:55:54 +0800 Subject: [PATCH] =?UTF-8?q?SoftDelete=20trait=20=E5=A2=9E=E5=8A=A0trashed?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E7=94=A8=E4=BA=8E=E5=88=A4=E6=96=AD=E5=BD=93?= =?UTF-8?q?=E5=89=8D=E6=95=B0=E6=8D=AE=E6=98=AF=E5=90=A6=E5=B7=B2=E7=BB=8F?= =?UTF-8?q?=E8=A2=AB=E8=BD=AF=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/traits/model/SoftDelete.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/library/traits/model/SoftDelete.php b/library/traits/model/SoftDelete.php index f580243a..c2d56f1e 100644 --- a/library/traits/model/SoftDelete.php +++ b/library/traits/model/SoftDelete.php @@ -4,6 +4,20 @@ namespace traits\model; trait SoftDelete { + + /** + * 判断当前实例是否被软删除 + * @access public + * @return boolean + */ + public function trashed() + { + if (!empty($this->data[static::$deleteTime])) { + return true; + } + return false; + } + /** * 查询软删除数据 * @access public