|
@@ -317,14 +317,16 @@ class PostRepositories
|
|
|
$perPage = isset($request['per_page']) ? $request['per_page'] : 20;
|
|
|
|
|
|
$where = [];
|
|
|
+ $id = 0;
|
|
|
if(isset($request['id'])){
|
|
|
- $where[] = ['post.id', '<>', $request['id']];
|
|
|
+ $id = $request['id'];
|
|
|
}
|
|
|
$where[] = ['type', 'video'];
|
|
|
return $this->post
|
|
|
->join('post_data', 'post_data.post_id', '=', 'post.id')
|
|
|
- ->select('post.*')
|
|
|
+ ->select('post.*', DB::raw("IF (post.id = {$id},1,0) as sort"))
|
|
|
->where($where)
|
|
|
+ ->orderBy('sort', 'desc')
|
|
|
->orderBy('weight','desc')
|
|
|
->paginate($perPage);
|
|
|
}
|