same at 22.05.2023

This commit is contained in:
Anatoliy Poloz
2023-05-22 09:52:08 +00:00
parent a9601ab15d
commit 1e546fa48e
216 changed files with 246857 additions and 6014 deletions

View File

@@ -118,6 +118,21 @@ class User extends Authenticatable implements MustVerifyEmail
return $this->belongsToMany(Plan::class, 'plan_author', 'user_id', 'plan_id');
}
public function author_of_diets()
{
return $this->belongsToMany(Diet::class, 'diet_author', 'user_id', 'diet_id');
}
public function author_of_blog_post()
{
return $this->belongsToMany(BlogPost::class, 'blog_post_author', 'user_id', 'blog_post_id');
}
public function author_of_recipe()
{
return $this->belongsToMany(Recipe::class, 'recipe_author', 'user_id', 'recipe_id');
}
public function plan_comments()
{
return $this->hasMany(PlanComment::class);
@@ -128,9 +143,63 @@ class User extends Authenticatable implements MustVerifyEmail
return $this->hasMany(PlanLike::class);
}
public function diet_comments()
{
return $this->hasMany(DietComment::class);
}
public function diet_likes(): HasMany
{
return $this->hasMany(DietLike::class);
}
public function comment_upvotes(): HasMany
{
return $this->hasMany(CommentUpvote::class);
}
public function diet_comment_upvotes(): HasMany
{
return $this->hasMany(DietCommentUpvote::class);
}
public function chosen_plan()
{
return $this->hasOne(ChoosePlan::class);
}
public function chosen_diet()
{
return $this->hasOne(ChosenDiet::class);
}
public function blog_post_comments()
{
return $this->hasMany(BlogPostComment::class);
}
public function blog_post_likes(): HasMany
{
return $this->hasMany(BlogPostLike::class);
}
public function blog_post_comment_upvotes(): HasMany
{
return $this->hasMany(BlogPostCommentUpvote::class);
}
public function recipe_comments()
{
return $this->hasMany(RecipeComment::class);
}
public function recipe_likes(): HasMany
{
return $this->hasMany(RecipeLike::class);
}
public function recipe_comment_upvotes(): HasMany
{
return $this->hasMany(RecipeCommentUpvote::class);
}
}