make static analyz for blogPost

This commit is contained in:
2024-01-10 14:42:34 +03:00
parent 93ca684f67
commit fb3670a549
14 changed files with 120 additions and 69 deletions

View File

@@ -4,17 +4,18 @@ namespace App\Livewire\BlogPost\Comment;
use App\Models\BlogPostComment;
use Livewire\Component;
use Illuminate\View\View;
class Upvote extends Component
{
public BlogPostComment $comment;
public function mount(BlogPostComment $comment)
public function mount(BlogPostComment $comment): void
{
$this->comment = $comment;
}
public function render()
public function render(): View
{
$upvotes = $this->comment->upvotes()->forBlogPostCommentsUpVote($this->comment)->count();
$downvotes = $this->comment->upvotes()->forBlogPostCommentsDownVote($this->comment)->count();
@@ -30,7 +31,7 @@ class Upvote extends Component
);
}
public function upvote()
public function upvote(): void
{
if ($this->comment->isUpVoted()) {
$this->comment->removeUpVote();
@@ -49,7 +50,7 @@ class Upvote extends Component
]);
}
public function downvote()
public function downvote(): void
{
if ($this->comment->isDownVoted()) {
$this->comment->removeDownVote();