Oh, I know my mistake. I have to create a one-to-many relationship instead of a many-to-many. Then it works :)
Okay that's not the solution :/ I definitely need a many-to-many-relationship because else I have the following problem:
If I want to get all researches and I eager load the research_costs table (which is a one-to-many relationship between it and researches) I get the costs for ALL levels within the array of ALL researches. But I need to have the costs only for the specific research, other wise it would be redundant.
In other words, I would like to access the costs like this
$researches[0]->research_costs
instead of
$researches[0]->research_costs[0]
I hope you understand the problem. Hence, I need to use a many-to-many relationship like explained above but it doesn't work :/
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community