Why did whereHas not work? That sounds like exactly what you need.
$answers = Answer::whereHas('question', function($query) {
$query->where('description','=','questionDescription');
})
->whereHas('question.survey', function($query) {
$query->where('description', '=', "surveyDescription");
})->get();
Many thanks @thomastkim : I thought my queries had to live inside one another and not side by side which should be the only combination I hadn't tried ! You did the trick :)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community