hello, i have a question regarding the filtering
i have a condition i need to apply like this
$students_list = Student::all();
$students_list[0]->examResult()->whereexamstype_id(6)->whereexam_result('Pass');
which return for me the student if he pass (will display his information, if not then will give an empty result)
and i was trying to make a better way of filtering so i got only the pass students to my view without make extra methodes or extra lines
so i make the code like this
$students_list = Student::all();
$students = $students_list->filter(function($student)
{
return $student->examResult()->whereexamstype_id(6)->whereexam_result('Pass');
});
but its give me the list of all students without filtering them so can someone tell me where is my mistake so i can fix it or i understand the filter mistake !!
thanks