I have following releation in my controller and it works fine .
$response=Event::with('eventDetail','eventDetail.members')->get();
Now i need to get total members of that event. Event has many event detail and each event detail has many members.
Event::with(
['eventDetail'=>function($query){
$query->count();
}])->with([
'eventDetail.members'=>function($query){
$query->count();
}
]
)->get();
but still its loading all data instead of count