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\RecipeCommentUpvote
@@ -42,22 +44,22 @@ class RecipeCommentUpvote extends Model
'type',
];
public function author()
public function author(): BelongsTo
{
return $this->belongsTo(User::class, 'user_id');
}
public function recipe_comment()
public function recipe_comment(): BelongsTo
{
return $this->belongsTo(BlogPostComment::class, 'recipe_comment_id');
}
public function scopeForRecipeCommentsUpVote($query, RecipeComment $comment)
public function scopeForRecipeCommentsUpVote(Builder $query, RecipeComment $comment): Builder
{
return $query->where('recipe_comment_id', $comment->id)->where('type', 'upvote');
}
public function scopeForRecipeCommentsDownVote($query, RecipeComment $comment)
public function scopeForRecipeCommentsDownVote(Builder $query, RecipeComment $comment): Builder
{
return $query->where('recipe_comment_id', $comment->id)->where('type', 'downvote');
}