It is solved by nested relationship.
$members = Members::with([ 'donations', 'donations.material' => function($query) use ($highestPriority) { $query->where('is_dontated', false); $query->where('priority', $highestPriority); } ])->get();
for more detail, please check this link. http://stackoverflow.com/questions/29295855/eager-loading-eloqent-for-realtionship-tables/29298045
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community