forked from mirror/pixelfed
Update LikeController
This commit is contained in:
parent
84e01f1132
commit
bed5cc74de
|
@ -23,7 +23,8 @@ class LikeController extends Controller
|
||||||
'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'));
|
$status = Status::withCount('likes')->findOrFail($request->input('item'));
|
||||||
|
|
||||||
$count = $status->likes_count;
|
$count = $status->likes_count;
|
||||||
|
@ -49,6 +50,8 @@ class LikeController extends Controller
|
||||||
LikePipeline::dispatch($like);
|
LikePipeline::dispatch($like);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Cache::forget('status:'.$status->id.':likedby:userid:'.$user->id);
|
||||||
|
|
||||||
if ($request->ajax()) {
|
if ($request->ajax()) {
|
||||||
$response = ['code' => 200, 'msg' => 'Like saved', 'count' => $count];
|
$response = ['code' => 200, 'msg' => 'Like saved', 'count' => $count];
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue