'float', 'carbohydrates' => 'float', 'cholesterol' => 'float', 'date' => 'datetime:Y-m-d', 'fat' => 'float', 'protein' => 'float', 'sodium' => 'float', ]; /** * @inheritdoc */ protected $with = ['user', 'foods:id,name,slug', 'recipes:id,name,slug']; /** * Get the User this entry belongs to. */ public function user(): BelongsTo { return $this->belongsTo(User::class); } /** * Get all recipes related to this entry. */ public function foods(): MorphToMany { return $this->morphedByMany(Food::class, 'journalable'); } /** * Get all recipes related to this entry. */ public function recipes(): MorphToMany { return $this->morphedByMany(Recipe::class, 'journalable'); } }