From f14107dc44e32ac05665561740620d3d384bdc19 Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Wed, 17 Jun 2020 16:19:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=95=8F=E6=84=9F=E8=AF=8D?= =?UTF-8?q?=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- catch/system/model/SensitiveWord.php | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/catch/system/model/SensitiveWord.php b/catch/system/model/SensitiveWord.php index 3855895..a765fe3 100644 --- a/catch/system/model/SensitiveWord.php +++ b/catch/system/model/SensitiveWord.php @@ -11,6 +11,7 @@ namespace catchAdmin\system\model; +use catchAdmin\permissions\model\Users; use catcher\base\CatchModel; class SensitiveWord extends CatchModel @@ -25,4 +26,35 @@ class SensitiveWord extends CatchModel 'updated_at', // 更新时间 'deleted_at', // 删除时间 ]; + + /** + * 词汇查询 + * + * @time 2020年06月17日 + * @param $query + * @param $value + * @param $data + * @return mixed + */ + public function searchWordAttr($query, $value, $data) + { + return $query->whereLike('word', $value); + } + + + /** + * 创建人 + * + * @time 2020年06月17日 + * @param $query + * @return mixed + */ + public function scopeCreator($query) + { + return $query->addSelectSub(function (){ + $user = app(Users::class); + return $user->whereColumn($this->getTable() . '.creator_id', $user->getTable() . '.id') + ->field('username'); + }, 'creator'); + } } \ No newline at end of file