analysators added

This commit is contained in:
Anatoliy Poloz
2023-12-18 14:36:32 +03:00
parent e9c4647f26
commit 92a54106ef
166 changed files with 32767 additions and 1222 deletions

View File

@@ -1,8 +1,9 @@
<?php
namespace App\Livewire\BlogPost\Comment;
use Livewire\Component;
use App\Models\BlogPostComment;
use Livewire\Component;
class Upvote extends Component
{
@@ -18,13 +19,14 @@ class Upvote extends Component
{
$upvotes = $this->comment->upvotes()->forBlogPostCommentsUpVote($this->comment)->count();
$downvotes = $this->comment->upvotes()->forBlogPostCommentsDownVote($this->comment)->count();
$sum = $upvotes - $downvotes;
$sum = $upvotes - $downvotes;
return view(
'livewire.blog-post.comment.upvote',
[
'sum' => $sum,
'isUpVoted' => $this->comment->isUpVoted(),
'isDownVoted' => $this->comment->isDownVoted()
'isDownVoted' => $this->comment->isDownVoted(),
]
);
}
@@ -33,7 +35,8 @@ class Upvote extends Component
{
if ($this->comment->isUpVoted()) {
$this->comment->removeUpVote();
return ;
return;
}
if ($this->comment->isDownVoted()) {
@@ -43,7 +46,7 @@ class Upvote extends Component
$this->comment->upvotes()->create([
'user_id' => auth()->id(),
'blog_post_comment_id' => $this->comment->id,
'type' => 'upvote'
'type' => 'upvote',
]);
}
@@ -51,7 +54,8 @@ class Upvote extends Component
{
if ($this->comment->isDownVoted()) {
$this->comment->removeDownVote();
return ;
return;
}
if ($this->comment->isUpVoted()) {
@@ -61,7 +65,7 @@ class Upvote extends Component
$this->comment->upvotes()->create([
'user_id' => auth()->id(),
'blog_post_comment_id' => $this->comment->id,
'type' => 'downvote'
'type' => 'downvote',
]);
}
}