forked from eatvio/eatvio-infra
04 10 2023 snapshot
This commit is contained in:
@@ -2,16 +2,20 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Auth\MustVerifyEmail as UserMustVerifyEmail;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Laravel\Fortify\TwoFactorAuthenticatable;
|
||||
use Laravel\Jetstream\HasProfilePhoto;
|
||||
use Laravel\Sanctum\HasApiTokens;
|
||||
use CyrildeWit\EloquentViewable\InteractsWithViews;
|
||||
use CyrildeWit\EloquentViewable\Contracts\Viewable;
|
||||
use App\Models\UserDetailz;
|
||||
use App\Models\CircumferenceMeasure;
|
||||
use App\Models\WeightMeasure;
|
||||
@@ -21,30 +25,32 @@ use App\Models\Plan;
|
||||
use App\Models\PlanLike;
|
||||
use App\Models\CommentUpvote;
|
||||
|
||||
class User extends Authenticatable implements MustVerifyEmail
|
||||
class User extends Authenticatable implements Viewable, MustVerifyEmail
|
||||
{
|
||||
use HasApiTokens;
|
||||
use HasFactory;
|
||||
use HasProfilePhoto;
|
||||
use Notifiable;
|
||||
use TwoFactorAuthenticatable;
|
||||
use InteractsWithViews;
|
||||
use UserMustVerifyEmail;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var string[]
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
'is_public_profile'
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be hidden for serialization.
|
||||
*
|
||||
* @var array
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $hidden = [
|
||||
'password',
|
||||
@@ -56,7 +62,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'email_verified_at' => 'datetime',
|
||||
@@ -65,43 +71,63 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
/**
|
||||
* The accessors to append to the model's array form.
|
||||
*
|
||||
* @var array
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $appends = [
|
||||
'profile_photo_url',
|
||||
];
|
||||
|
||||
public function diaries()
|
||||
/* public function author_of_blog_post()
|
||||
{
|
||||
return $this->belongsToMany(BlogPost::class, 'blog_post_author');
|
||||
}
|
||||
|
||||
public function author_of_plans()
|
||||
{
|
||||
return $this->belongsToMany(Plan::class, 'plan_author');
|
||||
}
|
||||
|
||||
public function author_of_diets()
|
||||
{
|
||||
return $this->belongsToMany(Diet::class, 'diet_author');
|
||||
}
|
||||
|
||||
public function author_of_recipe()
|
||||
{
|
||||
return $this->belongsToMany(Recipe::class, 'recipe_author');
|
||||
}
|
||||
*/
|
||||
public function diaries(): HasMany
|
||||
{
|
||||
return $this->hasMany(Diary::class);
|
||||
}
|
||||
|
||||
public function meals()
|
||||
public function meals(): HasMany
|
||||
{
|
||||
return $this->hasMany(Meal::class);
|
||||
}
|
||||
|
||||
public function detailz()
|
||||
public function detailz(): HasOne
|
||||
{
|
||||
return $this->hasOne(UserDetailz::class);
|
||||
}
|
||||
|
||||
public function circumference_measures()
|
||||
public function circumference_measures(): HasMany
|
||||
{
|
||||
return $this->hasMany(CircumferenceMeasure::class);
|
||||
}
|
||||
|
||||
public function weight_measures()
|
||||
public function weight_measures(): HasMany
|
||||
{
|
||||
return $this->hasMany(WeightMeasure::class);
|
||||
}
|
||||
|
||||
public function consultant_request()
|
||||
public function consultant_request(): HasOne
|
||||
{
|
||||
return $this->hasOne(ConsultantEducation::class);
|
||||
}
|
||||
|
||||
public function attachments()
|
||||
public function attachments(): HasMany
|
||||
{
|
||||
return $this->hasMany(UserAttachment::class);
|
||||
}
|
||||
@@ -113,27 +139,27 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
);
|
||||
}
|
||||
|
||||
public function author_of_plans()
|
||||
public function author_of_plans(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Plan::class, 'plan_author', 'user_id', 'plan_id');
|
||||
}
|
||||
|
||||
public function author_of_diets()
|
||||
public function author_of_diets(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Diet::class, 'diet_author', 'user_id', 'diet_id');
|
||||
}
|
||||
|
||||
public function author_of_blog_post()
|
||||
public function author_of_blog_post(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(BlogPost::class, 'blog_post_author', 'user_id', 'blog_post_id');
|
||||
}
|
||||
|
||||
public function author_of_recipe()
|
||||
public function author_of_recipe(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Recipe::class, 'recipe_author', 'user_id', 'recipe_id');
|
||||
}
|
||||
|
||||
public function plan_comments()
|
||||
public function plan_comments(): HasMany
|
||||
{
|
||||
return $this->hasMany(PlanComment::class);
|
||||
}
|
||||
@@ -143,7 +169,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
return $this->hasMany(PlanLike::class);
|
||||
}
|
||||
|
||||
public function diet_comments()
|
||||
public function diet_comments(): HasMany
|
||||
{
|
||||
return $this->hasMany(DietComment::class);
|
||||
}
|
||||
@@ -163,17 +189,17 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
return $this->hasMany(DietCommentUpvote::class);
|
||||
}
|
||||
|
||||
public function chosen_plan()
|
||||
public function chosen_plan(): HasOne
|
||||
{
|
||||
return $this->hasOne(ChoosePlan::class);
|
||||
return $this->hasOne(ChosenPlan::class);
|
||||
}
|
||||
|
||||
public function chosen_diet()
|
||||
public function chosen_diet(): HasOne
|
||||
{
|
||||
return $this->hasOne(ChosenDiet::class);
|
||||
}
|
||||
|
||||
public function blog_post_comments()
|
||||
public function blog_post_comments(): HasMany
|
||||
{
|
||||
return $this->hasMany(BlogPostComment::class);
|
||||
}
|
||||
@@ -188,7 +214,7 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
return $this->hasMany(BlogPostCommentUpvote::class);
|
||||
}
|
||||
|
||||
public function recipe_comments()
|
||||
public function recipe_comments(): HasMany
|
||||
{
|
||||
return $this->hasMany(RecipeComment::class);
|
||||
}
|
||||
@@ -202,4 +228,9 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
{
|
||||
return $this->hasMany(RecipeCommentUpvote::class);
|
||||
}
|
||||
|
||||
public function consultant_legal_entity(): HasOne
|
||||
{
|
||||
return $this->hasOne(ConsultantLegalEntity::class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user