forked from eatvio/eatvio-infra
make static analyz for blogPost
This commit is contained in:
@@ -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\BlogPostCommentUpvote
|
||||
@@ -36,28 +38,32 @@ class BlogPostCommentUpvote extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
|
||||
/**
|
||||
* @var array<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'blog_post_comment_id',
|
||||
'type',
|
||||
];
|
||||
|
||||
public function author()
|
||||
public function author(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
public function blog_post_comment()
|
||||
public function blog_post_comment(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(BlogPostComment::class, 'blog_post_comment_id');
|
||||
}
|
||||
|
||||
public function scopeForBlogPostCommentsUpVote($query, BlogPostComment $comment)
|
||||
public function scopeForBlogPostCommentsUpVote(Builder $query, BlogPostComment $comment): Builder
|
||||
{
|
||||
return $query->where('blog_post_comment_id', $comment->id)->where('type', 'upvote');
|
||||
}
|
||||
|
||||
public function scopeForBlogPostCommentsDownVote($query, BlogPostComment $comment)
|
||||
public function scopeForBlogPostCommentsDownVote(Builder $query, BlogPostComment $comment): Builder
|
||||
{
|
||||
return $query->where('blog_post_comment_id', $comment->id)->where('type', 'downvote');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user