I\'m quite new to Laravel and I\'m trying to figure out how to properly work with Eloquent so far so good, but I\'m stuck in something I want to do:
I have 3 tables in a
Based on the picture(ie your tables) you sent food_group does not have direct relationship with the portions so you can't chain food_group with portion like this
App\FoodGroup::with('portion.foods')
it should rather be (that is why you getting BadMethodCallException in Builder::portions())
App\FoodGroup::with('foods.portion')
because foodgroup has many foods and foods has many portion. so you can try something like this
App\FoodGroup::with(['foods.portion'=>function($q){
$q->orderBy('id')
}])->get();