瀏覽代碼

按照计数排序

visuddhinanda 2 年之前
父節點
當前提交
f2268da0cb
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      app/Http/Controllers/SearchPaliWbwController.php

+ 2 - 1
app/Http/Controllers/SearchPaliWbwController.php

@@ -82,7 +82,8 @@ class SearchPaliWbwController extends Controller
             $table = $table->whereIn('pcd_book_id',$bookId);
             $table = $table->whereIn('pcd_book_id',$bookId);
         }
         }
         $table = $table->groupBy('pcd_book_id')
         $table = $table->groupBy('pcd_book_id')
-                       ->selectRaw('pcd_book_id,count(*) as co');
+                       ->selectRaw('pcd_book_id,count(*) as co')
+                       ->orderBy('co','desc');
         $result = $table->get();
         $result = $table->get();
         return $this->ok(["rows"=>SearchBookResource::collection($result),"count"=>count($result)]);
         return $this->ok(["rows"=>SearchBookResource::collection($result),"count"=>count($result)]);
     }
     }