Well that's not a basic many to many relationship. What you have is:
A->C: One to many
B->C: One to many
D->C: One (or many) to many.
You need to create a model for the pivot table (not (only) pivot model).
Read this http://stackoverflow.com/a/24585837/784588
You can alternatively consider different approach - pivot table between three tables with this https://github.com/jarektkaczyk/Eloquent-triple-pivot. That depends on your needs.
Yes, it works :D
What I've looking for is:
$material = Material::with('elements', 'elementMaterials.otherModels')->first();
for querying relationship since I've already got pivot model.
Thanks for all the replies!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community