|
@@ -558,18 +558,23 @@ class PostRepositories
|
|
|
|
|
|
$where = [];
|
|
$where = [];
|
|
$topic = $this->topic;
|
|
$topic = $this->topic;
|
|
|
|
+ if(isset($request['name'])){
|
|
|
|
+ $where[] = ['topic.name', 'like', "%{$request['name']}%"];
|
|
|
|
+ }
|
|
|
|
+
|
|
if(isset($request['category_id']) && $request['category_id']){
|
|
if(isset($request['category_id']) && $request['category_id']){
|
|
if($request['category_id'] == -2){
|
|
if($request['category_id'] == -2){
|
|
$where[] = ['topic.is_hot', 1];
|
|
$where[] = ['topic.is_hot', 1];
|
|
}else{
|
|
}else{
|
|
- $topic = $topic->join('category_topic', 'category_topic.topic_id', '=', 'topic.id')->select('topic.*');
|
|
|
|
|
|
+ $topic = $topic->join('category_topic', 'category_topic.topic_id', '=', 'topic.id')->select('topic.*','category_topic.id as cid');
|
|
$where[] = ['category_topic.category_id', $request['category_id']];
|
|
$where[] = ['category_topic.category_id', $request['category_id']];
|
|
|
|
+ return $topic
|
|
|
|
+ ->where($where)
|
|
|
|
+ ->orderBy('cid','asc')
|
|
|
|
+ ->paginate($perPage);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- if(isset($request['name'])){
|
|
|
|
- $where[] = ['topic.name', 'like', "%{$request['name']}%"];
|
|
|
|
- }
|
|
|
|
return $topic
|
|
return $topic
|
|
->where($where)
|
|
->where($where)
|
|
->orderBy('id','desc')
|
|
->orderBy('id','desc')
|