Help Needed for Nested Eager Loading Constraints
I'm trying to fetch from the database nested query that's not in relationship with current model, In the attachment Division Model have a relationship with results , and results have relationship candidate , i need to fetch the candidate result along with division result , how to do that?? please check the below image : https://drive.google.com/file/d/1vpRW43KHLDesTnE1tCo2xzqss4iXxg0b/view?usp=sharing
Okay I found some solution , In side the my model i added Eager loading by default , So even i fetch the data from Results its coming with default Relationship
So code look like this (controller). Let me know if you have any other method !
$news2 =Division::with('results')
->with('districts')
->where([['result_released',1]])->get();
Result Model
protected $with = ['candidates'];