mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-24 16:53:17 +00:00
Update LikeController
This commit is contained in:
parent
84e01f1132
commit
bed5cc74de
1 changed files with 6 additions and 3 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue