jauhar54 2 years ago
parent
commit
6ab8a90006
1 changed files with 3 additions and 3 deletions
  1. 3
    3
      app/Http/Controllers/Api/V1/PointLogController.php

+ 3
- 3
app/Http/Controllers/Api/V1/PointLogController.php View File

22
 
22
 
23
     public function getAll()
23
     public function getAll()
24
     {
24
     {
25
-        $query = User::select('users.name', 'users.id as user_id', DB::raw('SUM(point_logs.point) as total_point'))->rightJoin('point_logs', 'point_logs.user_id', 'users.id')->groupBy('point_logs.user_id')->orderBy('total_point', 'desc')->limit(5)->get();
25
+        $query = User::select('users.name', 'users.id as user_id', DB::raw('SUM(point_logs.point) as total_point'))->rightJoin('point_logs', 'point_logs.user_id', 'users.id')->groupBy('point_logs.user_id')->orderBy('total_point', 'desc')->limit(10)->get();
26
 
26
 
27
         if($query){
27
         if($query){
28
             $result = $query;
28
             $result = $query;
45
     
45
     
46
     public function getNonEvent()
46
     public function getNonEvent()
47
     {
47
     {
48
-        $query = User::select('users.name', 'users.id as user_id', DB::raw('SUM(point_logs.point) as total_point'))->rightJoin('point_logs', 'point_logs.user_id', 'users.id')->where('event_id', '=', 0)->groupBy('point_logs.user_id')->orderBy('total_point', 'desc')->limit(5)->get();
48
+        $query = User::select('users.name', 'users.id as user_id', DB::raw('SUM(point_logs.point) as total_point'))->rightJoin('point_logs', 'point_logs.user_id', 'users.id')->where('event_id', '=', 0)->groupBy('point_logs.user_id')->orderBy('total_point', 'desc')->limit(10)->get();
49
 
49
 
50
         if($query){
50
         if($query){
51
             $result = $query;
51
             $result = $query;
68
 
68
 
69
     public function getWithEvent()
69
     public function getWithEvent()
70
     {
70
     {
71
-        $query = User::select('users.name', 'users.id as user_id', DB::raw('SUM(point_logs.point) as total_point'))->rightJoin('point_logs', 'point_logs.user_id', 'users.id')->where('event_id', '=', 1)->groupBy('point_logs.user_id')->orderBy('total_point', 'desc')->limit(5)->get();
71
+        $query = User::select('users.name', 'users.id as user_id', DB::raw('SUM(point_logs.point) as total_point'))->rightJoin('point_logs', 'point_logs.user_id', 'users.id')->where('event_id', '=', 1)->groupBy('point_logs.user_id')->orderBy('total_point', 'desc')->limit(10)->get();
72
 
72
 
73
         if($query){
73
         if($query){
74
             $result = $query;
74
             $result = $query;

Loading…
Cancel
Save