hasOne(TemplateMessage::class,'tempkey','wechat_tempkey'); } public function routineTemplate() { return $this->hasOne(TemplateMessage::class,'tempkey','routine_tempkey'); } public function searchKeywordAttr($query, $value) { $query->whereLike("notice_title|notice_key|notice_info","%{$value}%"); } public function searchTypeAttr($query, $value) { $query->where("type",$value); } public function searchConstKeyAttr($query, $value) { $query->where("const_key",$value); } }