I have three tables
Question table:
id
title
description
Answer table:
id
answerbody
question_id
Likes table:
id
answer_id
I want to retrieve single question details with all the answers and answer_count and their respective likes (only like_count)
I tried this
public function show($id)
{
return question::with(['answers','answers.likes'])->withCount(['answers'])->where('id',$id)-
>get();
}
How do I return likes with count?