Hi I have three tables
Recipes
id | name
1 | Spaghetti
Food
id | name
1 | tomato
2 | banana
Ingredient Recipes
id | idRecipe | idFood
1 | 1 | 1
2 | 1 | 2
How to from Recipes I can get all name Food through table Ingredient Recipes?
In Model Recipes I use Eloquent relationship Has many through but it not work
public function NameFood()
{
return $this->hasManyThrough('App\Food', 'App\IngredientRecipes', 'idRecipe', 'id', 'idFood');
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire