I have five tables in MySQL, School, Student, Session, Class now I want to generate a report on Enrollment table it does not count the male or female students who are enrolled in 2019-2020, below are the controller function code
$enro=Enrollement::groupBy('class_id','class_section','session_id')
->get();
here is the view blade code
<td style="border: 1px solid black;">{{ $value->students()->get()->where('student_gender','Male')->count() }} </td>
<td style="border: 1px solid black;">{{ $value->students()->get()->where('student_gender','Female')->count()}} </td>
it gets only 1 for Male and 1 for Female where I have 2 enrollment of Male and 2 for Female.
I don't know how to solve this problem any suggestion
It is a simple report, for example, I want to show in session 2019-2020, Class 7th, Section A, the N Number of Female and Male Students are enrolled.