staudenmeir / eloquent-has-many-deep

Laravel Eloquent HasManyThrough relationships with unlimited levels
MIT License
2.67k stars 157 forks source link

Question: One-To-Many to Many-To-One #121

Closed regnerisch closed 3 years ago

regnerisch commented 3 years ago

I have a table structure like that:

conferences
- id

sessions
- id
- conference_id
- speaker_id

speaker
- id

Is it possible to use this library to create a speakersrelation on the conference model? I do not see a hint in the documentation.

If it is possible, how can i implement something like that?

Thank you in advance!

staudenmeir commented 3 years ago

Do you mean a native BelongsToMany relationship?

https://laravel.com/docs/8.x/eloquent-relationships#many-to-many

regnerisch commented 3 years ago

LOL, I did not see it, you are right, it is just a BelongsToMany, I'm sorry.