mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Update LikeController
This commit is contained in:
parent
f89852c321
commit
fdac53eb77
1 changed files with 4 additions and 8 deletions
|
@ -33,20 +33,16 @@ class LikeController extends Controller
|
|||
$like = Like::whereProfileId($profile->id)->whereStatusId($status->id)->firstOrFail();
|
||||
$like->forceDelete();
|
||||
$count--;
|
||||
if($count >= 0) {
|
||||
$status->likes_count = $count;
|
||||
$status->save();
|
||||
}
|
||||
$status->likes_count = $count;
|
||||
$status->save();
|
||||
} else {
|
||||
$like = new Like();
|
||||
$like->profile_id = $profile->id;
|
||||
$like->status_id = $status->id;
|
||||
$like->save();
|
||||
$count++;
|
||||
if($count >= 0) {
|
||||
$status->likes_count = $count;
|
||||
$status->save();
|
||||
}
|
||||
$status->likes_count = $count;
|
||||
$status->save();
|
||||
LikePipeline::dispatch($like);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue