eating plan added

This commit is contained in:
Anatoliy Poloz
2022-07-27 14:53:16 +00:00
parent 0f1cafb518
commit a9601ab15d
146 changed files with 37111 additions and 127 deletions

View File

@@ -8,6 +8,7 @@ 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;
@@ -16,6 +17,9 @@ use App\Models\CircumferenceMeasure;
use App\Models\WeightMeasure;
use App\Models\ConsultantEducation;
use App\Models\UserAttachment;
use App\Models\Plan;
use App\Models\PlanLike;
use App\Models\CommentUpvote;
class User extends Authenticatable implements MustVerifyEmail
{
@@ -109,4 +113,24 @@ class User extends Authenticatable implements MustVerifyEmail
);
}
public function author_of_plans()
{
return $this->belongsToMany(Plan::class, 'plan_author', 'user_id', 'plan_id');
}
public function plan_comments()
{
return $this->hasMany(PlanComment::class);
}
public function plan_likes(): HasMany
{
return $this->hasMany(PlanLike::class);
}
public function comment_upvotes(): HasMany
{
return $this->hasMany(CommentUpvote::class);
}
}