Belongs-To with Many-to-Many relationships #266
-
I want User ->
|
Beta Was this translation helpful? Give feedback.
Answered by
staudenmeir
Mar 15, 2025
Replies: 1 comment 1 reply
-
Hi @yungts97, class User extends Model
{
use \Staudenmeir\EloquentHasManyDeep\HasRelationships;
public function countries(): \Staudenmeir\EloquentHasManyDeep\HasManyDeep
{
return $this->hasManyDeep(Country::class, [Team::class, 'country_team'], ['id'], ['team_id']);
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
yungts97
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @yungts97,
Use this relationship: