category = $category; $this->categoryTopic = $categoryTopic; } //列表 public function lists($request) { $where = []; if(isset($request['is_suggest'])){ $where[] = ['is_suggest', '=', $request['is_suggest']]; } return $this->category->where($where)->get(); } //获取多个话题 public function getTopics($ids){ $ids = explode(',',$ids); return $this->categoryTopic ->leftJoin('topic', 'category_topic.topic_id', '=', 'topic.id') ->where('topic.is_suggest',1) ->whereIn('category_topic.category_id',$ids) ->select('topic.id','topic.name','topic.is_suggest') ->get(); } }