refactoring static analyse code

This commit is contained in:
2024-01-09 10:46:41 +03:00
parent a93719a99a
commit 590d3b987d
39 changed files with 293 additions and 280 deletions

View File

@@ -4,6 +4,8 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Builder;
/**
* App\Models\CommentUpvote
@@ -42,22 +44,22 @@ class CommentUpvote extends Model
'type',
];
public function plan_comment()
public function plan_comment(): BelongsTo
{
return $this->belongsTo(PlanComment::class, 'comment_id');
}
public function author()
public function author(): BelongsTo
{
return $this->belongsTo(User::class, 'user_id');
}
public function scopeForPlanCommentsUpVote($query, PlanComment $comment)
public function scopeForPlanCommentsUpVote(Builder $query, PlanComment $comment): Builder
{
return $query->where('comment_id', $comment->id)->where('type', 'upvote');
}
public function scopeForPlanCommentsDownVote($query, PlanComment $comment)
public function scopeForPlanCommentsDownVote(Builder $query, PlanComment $comment): Builder
{
return $query->where('comment_id', $comment->id)->where('type', 'downvote');
}