Update DiscoverController

pull/1328/head
Daniel Supernault 6 years ago
parent b02148d110
commit f9f38ac4d4
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7

@ -143,14 +143,17 @@ class DiscoverController extends Controller
abort_if(!config('exp.loops'), 403);
// todo proper pagination, maybe LoopService
$loops = Status::whereType('video')
->whereScope('public')
->latest()
->take(18)
->get();
$resource = new Fractal\Resource\Collection($loops, new StatusStatelessTransformer());
return $this->fractal->createData($resource)->toArray();
$res = Cache::remember('discover:loops:recent', now()->addHours(1), function() {
$loops = Status::whereType('video')
->whereScope('public')
->latest()
->take(18)
->get();
$resource = new Fractal\Resource\Collection($loops, new StatusStatelessTransformer());
return $this->fractal->createData($resource)->toArray();
});
return $res;
}

Loading…
Cancel
Save