Update LikeController

pull/1418/head
Daniel Supernault 6 years ago
parent ea48792bf6
commit 9f928ae570
No known key found for this signature in database
GPG Key ID: 0DEF1C662C9033F7

@ -32,20 +32,23 @@ 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();
}
} 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();
}
LikePipeline::dispatch($like);
}
$likes = Like::whereProfileId($profile->id)
->orderBy('id', 'desc')
->take(1000)
->pluck('status_id');
if ($request->ajax()) {
$response = ['code' => 200, 'msg' => 'Like saved', 'count' => $count];
} else {

Loading…
Cancel
Save