Support the ongoing development of Laravel.io →
posted 8 years ago
Eloquent
Last updated 1 year 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 8 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.