I have a query where I get data using with , but in that table I have another relationship and I want to get data from that, and I am not sure how.
The result that I need is between question_topics and lk_answers (there I have the names for topic_1, topic_2 ...)
public function index(Request $request)
{
$query = Question::select(['id', 'free_text', 'title', 'topics_id', 'created_at']);
$query->with('question_topics');
$query->question_topics->with('lkp_answers'); // something like that, but this line is not working.
return response()->json($query->paginate(5));
}
