|
|
@ -33,20 +33,16 @@ class LikeController extends Controller
|
|
|
|
$like = Like::whereProfileId($profile->id)->whereStatusId($status->id)->firstOrFail();
|
|
|
|
$like = Like::whereProfileId($profile->id)->whereStatusId($status->id)->firstOrFail();
|
|
|
|
$like->forceDelete();
|
|
|
|
$like->forceDelete();
|
|
|
|
$count--;
|
|
|
|
$count--;
|
|
|
|
if($count >= 0) {
|
|
|
|
|
|
|
|
$status->likes_count = $count;
|
|
|
|
$status->likes_count = $count;
|
|
|
|
$status->save();
|
|
|
|
$status->save();
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
$like = new Like();
|
|
|
|
$like = new Like();
|
|
|
|
$like->profile_id = $profile->id;
|
|
|
|
$like->profile_id = $profile->id;
|
|
|
|
$like->status_id = $status->id;
|
|
|
|
$like->status_id = $status->id;
|
|
|
|
$like->save();
|
|
|
|
$like->save();
|
|
|
|
$count++;
|
|
|
|
$count++;
|
|
|
|
if($count >= 0) {
|
|
|
|
|
|
|
|
$status->likes_count = $count;
|
|
|
|
$status->likes_count = $count;
|
|
|
|
$status->save();
|
|
|
|
$status->save();
|
|
|
|
}
|
|
|
|
|
|
|
|
LikePipeline::dispatch($like);
|
|
|
|
LikePipeline::dispatch($like);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|