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

@@ -5,6 +5,8 @@ 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;
use App\Models\User;
/**
* App\Models\PlanComment
@@ -40,12 +42,12 @@ class PlanComment extends Model
{
use HasFactory;
public function author()
public function author(): BelongsTo
{
return $this->belongsTo(User::class, 'user_id');
return $this->belongsTo(User::class, 'user_id');
}
public function plan()
public function plan(): BelongsTo
{
return $this->belongsTo(Plan::class, 'plan_id');
}
@@ -55,7 +57,7 @@ class PlanComment extends Model
return $this->hasMany(CommentUpvote::class, 'comment_id');
}
public function isUpVoted(): bool
public function isUpVoted(): bool|int
{
if (auth()->user()) {
return auth()
@@ -68,7 +70,7 @@ class PlanComment extends Model
return false;
}
public function isDownVoted(): bool
public function isDownVoted(): bool|int
{
if (auth()->user()) {
return auth()