From fec7ee8505cedaa02a19c63c6a2e6c9cd6d8fe5a Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Mon, 23 Jul 2018 11:30:33 -0600 Subject: [PATCH] Update LikeController --- app/Http/Controllers/LikeController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/LikeController.php b/app/Http/Controllers/LikeController.php index 4cc5982db..a6cd00a89 100644 --- a/app/Http/Controllers/LikeController.php +++ b/app/Http/Controllers/LikeController.php @@ -3,7 +3,7 @@ namespace App\Http\Controllers; use Illuminate\Http\Request; -use Auth, Hashids; +use Auth, Cache, Hashids; use App\{Like, Profile, Status, User}; use App\Jobs\LikePipeline\LikePipeline; @@ -38,6 +38,12 @@ class LikeController extends Controller LikePipeline::dispatch($like); } + $likes = Like::whereProfileId($profile->id) + ->orderBy('id', 'desc') + ->take(1000) + ->pluck('status_id'); + + Cache::put('api:like-ids:user:'.$profile->id, $likes, 1440); if($request->ajax()) { $response = ['code' => 200, 'msg' => 'Like saved', 'count' => $count];