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,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\RecipeComment
@@ -40,12 +41,12 @@ class RecipeComment extends Model
{
use HasFactory;
public function author()
public function author(): BelongsTo
{
return $this->belongsTo(User::class, 'user_id');
}
public function recipe()
public function recipe(): BelongsTo
{
return $this->belongsTo(Recipe::class, 'recipe_id');
}
@@ -55,7 +56,7 @@ class RecipeComment extends Model
return $this->hasMany(RecipeCommentUpvote::class, 'recipe_comment_id');
}
public function isUpVoted(): bool
public function isUpVoted(): bool|int
{
$curUser = auth()->user();
if ($curUser) {
@@ -68,7 +69,7 @@ class RecipeComment extends Model
return false;
}
public function isDownVoted(): bool
public function isDownVoted(): bool|int
{
$curUser = auth()->user();
if ($curUser) {
@@ -81,7 +82,7 @@ class RecipeComment extends Model
return false;
}
public function removeUpVote(): bool
public function removeUpVote(): bool|int
{
$curUser = auth()->user();
if ($curUser) {
@@ -94,7 +95,7 @@ class RecipeComment extends Model
return false;
}
public function removeDownVote(): bool
public function removeDownVote(): bool|int
{
$curUser = auth()->user();
if ($curUser) {