Selaa lähdekoodia

Update BaseApiController

Daniel Supernault 6 vuotta sitten
vanhempi
commit
080516a7eb
1 muutettua tiedostoa jossa 2 lisäystä ja 2 poistoa
  1. 2 2
      app/Http/Controllers/Api/BaseApiController.php

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

@@ -59,8 +59,8 @@ class BaseApiController extends Controller
         $timeago = Carbon::now()->subMonths(6);
         $timeago = Carbon::now()->subMonths(6);
         $notifications = Notification::whereProfileId($pid)
         $notifications = Notification::whereProfileId($pid)
             ->whereDate('created_at', '>', $timeago)
             ->whereDate('created_at', '>', $timeago)
-            ->orderBy('created_at','desc')
-            ->paginate(10);
+            ->latest()
+            ->simplePaginate(10);
         $resource = new Fractal\Resource\Collection($notifications, new NotificationTransformer());
         $resource = new Fractal\Resource\Collection($notifications, new NotificationTransformer());
         $res = $this->fractal->createData($resource)->toArray();
         $res = $this->fractal->createData($resource)->toArray();