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

@@ -5,6 +5,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* App\Models\BlogPostComment
@@ -39,12 +40,12 @@ class BlogPostComment extends Model
{
use HasFactory;
public function author()
public function author(): BelongsTo
{
return $this->belongsTo(User::class, 'user_id');
}
public function blog_post()
public function blog_post(): BelongsTo
{
return $this->belongsTo(BlogPost::class, 'blog_post_id');
}
@@ -54,7 +55,7 @@ class BlogPostComment extends Model
return $this->hasMany(BlogPostCommentUpvote::class, 'blog_post_comment_id');
}
public function isUpVoted(): bool
public function isUpVoted(): bool|int
{
$curUser = auth()->user();
if ($curUser) {
@@ -67,7 +68,7 @@ class BlogPostComment extends Model
return false;
}
public function isDownVoted(): bool
public function isDownVoted(): bool|int
{
$curUser = auth()->user();
if ($curUser) {