From bed5cc74dee312c77e8212e9e53d90b2fda33144 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Tue, 18 Jun 2019 00:47:57 -0600 Subject: [PATCH] Update LikeController --- app/Http/Controllers/LikeController.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/LikeController.php b/app/Http/Controllers/LikeController.php index ef4ab26e..08e0a421 100644 --- a/app/Http/Controllers/LikeController.php +++ b/app/Http/Controllers/LikeController.php @@ -20,10 +20,11 @@ class LikeController extends Controller public function store(Request $request) { $this->validate($request, [ - 'item' => 'required|integer|min:1', - ]); + 'item' => 'required|integer|min:1', + ]); - $profile = Auth::user()->profile; + $user = Auth::user(); + $profile = $user->profile; $status = Status::withCount('likes')->findOrFail($request->input('item')); $count = $status->likes_count; @@ -49,6 +50,8 @@ class LikeController extends Controller LikePipeline::dispatch($like); } + Cache::forget('status:'.$status->id.':likedby:userid:'.$user->id); + if ($request->ajax()) { $response = ['code' => 200, 'msg' => 'Like saved', 'count' => $count]; } else {