Support the ongoing development of Laravel.io →
posted 9 years ago
Eloquent
Last updated 2 years ago.
0

How are you querying it? What is your primary key for both Ingredient and Recipe?

0

Both are the default 'id'.

$recipe = Recipe::find(1); var_dump($recipe->ingredients);

0

That's weird. That should work. Does it still not work if you eagerload it?

$recipe = Recipe::with('ingredients')->find(1); var_dump($recipe->ingredients);
Last updated 9 years ago.
0

thomastkim said:

That's weird. That should work. Does it still not work if you eagerload it?

$recipe = Recipe::with('ingredients')->find(1); var_dump($recipe->ingredients);

you beat me to it...

0

Sign in to participate in this thread!

Eventy

Your banner here too?

marcoacm marcoacm Joined 12 Oct 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.