抽象scope trait

This commit is contained in:
JaguarJack
2020-06-21 10:50:05 +08:00
parent 448154f363
commit 11f6419b4f
4 changed files with 30 additions and 22 deletions

View File

@@ -40,21 +40,4 @@ class SensitiveWord extends CatchModel
{
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');
}
}