瀏覽代碼

Update ApiController

Daniel Supernault 5 年之前
父節點
當前提交
9a50a6f627
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      app/Http/Controllers/Api/ApiV1Controller.php

+ 2 - 2
app/Http/Controllers/Api/ApiV1Controller.php

@@ -1164,14 +1164,14 @@ class ApiV1Controller extends Controller
             $id = $min ?? $max;
             $id = $min ?? $max;
             $notifications = Notification::whereProfileId($pid)
             $notifications = Notification::whereProfileId($pid)
                 ->whereDate('created_at', '>', $timeago)
                 ->whereDate('created_at', '>', $timeago)
-                ->latest()
                 ->where('id', $dir, $id)
                 ->where('id', $dir, $id)
+                ->orderByDesc('created_at')
                 ->limit($limit)
                 ->limit($limit)
                 ->get();
                 ->get();
         } else {
         } else {
             $notifications = Notification::whereProfileId($pid)
             $notifications = Notification::whereProfileId($pid)
                 ->whereDate('created_at', '>', $timeago)
                 ->whereDate('created_at', '>', $timeago)
-                ->latest()
+                ->orderByDesc('created_at')
                 ->simplePaginate($limit);
                 ->simplePaginate($limit);
         }
         }
         $resource = new Fractal\Resource\Collection($notifications, new NotificationTransformer());
         $resource = new Fractal\Resource\Collection($notifications, new NotificationTransformer());