From cffcf1119226e5569b7779d6c4b9bea4dc217f85 Mon Sep 17 00:00:00 2001 From: wuyanwen Date: Mon, 13 Jan 2020 21:24:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Etraits=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/catcher/traits/db/BaseOptionsTrait.php | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/extend/catcher/traits/db/BaseOptionsTrait.php b/extend/catcher/traits/db/BaseOptionsTrait.php index 819ce88..3f0a199 100644 --- a/extend/catcher/traits/db/BaseOptionsTrait.php +++ b/extend/catcher/traits/db/BaseOptionsTrait.php @@ -75,4 +75,27 @@ trait BaseOptionsTrait { return static::onlyTrashed()->find($id)->restore(); } + + /** + * 获取删除字段 + * + * @time 2020年01月13日 + * @return mixed + */ + public function getDeleteAtField() + { + return $this->deleteTime; + } + + /** + * 别名 + * + * @time 2020年01月13日 + * @param $field + * @return string + */ + public function aliasField($field): string + { + return sprintf('%s.%s', $this->getTable(), $field); + } }