Parcourir la source

按照计数排序

visuddhinanda il y a 2 ans
Parent
commit
f2268da0cb
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  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->groupBy('pcd_book_id')
-                       ->selectRaw('pcd_book_id,count(*) as co');
+                       ->selectRaw('pcd_book_id,count(*) as co')
+                       ->orderBy('co','desc');
         $result = $table->get();
         return $this->ok(["rows"=>SearchBookResource::collection($result),"count"=>count($result)]);
     }