MealPostVisibility::Private->value, 'ai_generated' => false, 'diet_type' => DietType::OMNIVORE->value, ]; public function user(): BelongsTo { return $this->belongsTo(User::class); } public function ingredients(): HasMany { return $this->hasMany(MealPostIngredients::class)->orderBy('position'); } public function reviews(): HasMany { return $this->hasMany(PostReviews::class, 'meal_post_id'); } public function likedByUsers(): BelongsToMany { return $this->belongsToMany(User::class, 'meal_post_likes', 'meal_posts_id', 'user_id') ->withTimestamps(); } protected function casts(): array { return [ 'eaten_at' => 'datetime', 'visibility' => MealPostVisibility::class, 'type' => MealPostType::class, 'diet_type' => DietType::class, 'ai_generated' => 'boolean', ]; } }