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

I would do it the other way. Go in from the platform side of the relationship because that is the thing you are searching against.

$platform = Platform::with('user')->where('platform_id', 1)->first(); foreach($platform->users as $user) { echo "username: $user->username , pivot value: $user->pivot->some_value"; }

assuming you have the relationship setup in the Platform model.

might work

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

tiagoitsme tiagoitsme Joined 10 Mar 2014

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.